diff options
author | Max Horn | 2002-07-27 13:27:34 +0000 |
---|---|---|
committer | Max Horn | 2002-07-27 13:27:34 +0000 |
commit | 403afb0514a796c77d004b5be342946ffc023953 (patch) | |
tree | d0c3ab61c3649a0fe021b33a3e37ec397970c27c | |
parent | ea7c0aa94b73ecae1c83240afa31b774c2a21940 (diff) | |
download | scummvm-rg350-403afb0514a796c77d004b5be342946ffc023953.tar.gz scummvm-rg350-403afb0514a796c77d004b5be342946ffc023953.tar.bz2 scummvm-rg350-403afb0514a796c77d004b5be342946ffc023953.zip |
added isEmpty() methods to String and List class; fixed crasher that occured when saving/loading in NewGUI when nothing was selected
svn-id: r4655
-rw-r--r-- | gui/dialog.cpp | 4 | ||||
-rw-r--r-- | util.h | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 88c9cecc51..c4f53892c7 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -304,7 +304,7 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat { switch (cmd) { case kSaveCmd: - if (_savegameList->getSelectedString()[0] != 0) { + if (_savegameList->getSelected() > 0 && !_savegameList->getSelectedString().isEmpty()) { Scumm *s = _gui->getScumm(); s->_saveLoadSlot = _savegameList->getSelected(); s->_saveLoadCompatible = false; @@ -314,7 +314,7 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat } break; case kLoadCmd: - if (_savegameList->getSelectedString()[0] != 0) { + if (_savegameList->getSelected() > 0 && !_savegameList->getSelectedString().isEmpty()) { Scumm *s = _gui->getScumm(); s->_saveLoadSlot = _savegameList->getSelected(); s->_saveLoadCompatible = false; @@ -103,6 +103,8 @@ public: _size = 0; _capacity = 0; } + + bool isEmpty() const { return (_size == 0); } protected: void ensureCapacity(int new_len) @@ -150,6 +152,8 @@ public: void deleteLastChar(); void clear(); + bool isEmpty() const { return (_len == 0); } + protected: void ensureCapacity(int new_len, bool keep_old); void decRefCount(); |