From: Mark Thom Date: Thu, 18 Mar 2021 00:58:33 +0000 (-0600) Subject: check that a load context path is a filename before potentially returning it as a... X-Git-Tag: v0.9.0~123 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=7937ccee304d18d91ca638d27d2babe5200aba17;p=scryer-prolog.git check that a load context path is a filename before potentially returning it as a string --- diff --git a/src/machine/compile.rs b/src/machine/compile.rs index 3e96672e..629d790e 100644 --- a/src/machine/compile.rs +++ b/src/machine/compile.rs @@ -1318,6 +1318,10 @@ fn print_overwrite_warning( impl<'a> LoadState<'a> { pub(super) fn listing_src_file_name(&self) -> Option { if let Some(load_context) = self.wam.load_contexts.last() { + if !load_context.path.is_file() { + return None; + } + if let Some(path_str) = load_context.path.to_str() { if !path_str.is_empty() { return Some(clause_name!(path_str.to_string(), self.wam.machine_st.atom_tbl));