Mercurial > octave
changeset 24568:4db06f3bc34f
edit.m: Don't error out if "Cancel" button is used in save dialog (bug #52841).
* edit.m: Check return class of uiputfile(). If it is not char, then
user pressed "Cancel" and function returns without doing anything.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 09 Jan 2018 09:32:57 -0800 |
parents | 3fa85fe6e495 |
children | bcb8ce5c4e16 |
files | scripts/miscellaneous/edit.m |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/miscellaneous/edit.m Mon Jan 08 22:13:35 2018 -0500 +++ b/scripts/miscellaneous/edit.m Tue Jan 09 09:32:57 2018 -0800 @@ -330,7 +330,7 @@ endif endif - ## If editing a new file, prompt for creation if gui is running + ## If editing a new file, prompt for creation if GUI is running if (isguirunning ()) if (! __octave_link_edit_file__ (file, "prompt")); return; @@ -358,6 +358,9 @@ ## Write the initial file (if there is anything to write) ## Give user the opportunity to change the file extension fileandpath = uiputfile (fileandpath); + if (! ischar (fileandpath)) + return; # Cancel Button pressed + endif fid = fopen (fileandpath, "wt"); if (fid < 0) error ("edit: could not create %s", fileandpath);