mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Fix crash when saving a file with no contents or with no name
This commit is contained in:
parent
62c24826e6
commit
b3a9f4423b
2 changed files with 11 additions and 2 deletions
|
@ -424,13 +424,16 @@ void UINotepad::Save(Event *ev)
|
|||
{
|
||||
if (!m_filename.length()) {
|
||||
SaveAs(NULL);
|
||||
// Fixed in OPM:
|
||||
// devs probably forgot to return here - saving was attempted,
|
||||
// even though there was no filename to save the file with
|
||||
return;
|
||||
}
|
||||
|
||||
str filecontents;
|
||||
m_edit->getData(filecontents);
|
||||
m_edit->setChanged(false);
|
||||
|
||||
// FIXME: m_filename could be blank
|
||||
FS_WriteTextFile(m_filename, filecontents, filecontents.length());
|
||||
|
||||
str result = "Saved " + m_filename;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue