changeset 29437:c24e190ae34f stable

do not run files that are not saved as octave files (bug #60214) * file-editor-tab.cc (run_file): check for valid file name and for octave file before running the file
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 14 Mar 2021 13:09:16 +0100
parents 2c60e63ff1db
children 23424aa7a11a
files libgui/src/m-editor/file-editor-tab.cc
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Sat Mar 13 17:24:43 2021 +0100
+++ b/libgui/src/m-editor/file-editor-tab.cc	Sun Mar 14 13:09:16 2021 +0100
@@ -1016,8 +1016,12 @@
     if (m_edit_area->isModified () | ! valid_file_name ())
       {
         save_file (m_file_name);  // save file dialog
-        if (! valid_file_name ())
-          return;   // still invalid filename: "save as" was cancelled
+
+        // Running a file is disabled for non-octave files. But when saving
+        // a new file, an octave file is assumed but might actually saved
+        // as another file or with an invalid file name.
+        if (! (m_is_octave_file && valid_file_name ()))
+          return;
       }
 
     if (step_into)