mirror of https://github.com/stella-emu/stella.git
Fix memory corruption if history is empty.
This commit is contained in:
parent
a582a64cb6
commit
e86bf5df78
|
@ -259,16 +259,16 @@ string& FileListWidget::fixPath(string& path)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FileListWidget::addHistory(const FilesystemNode& node)
|
void FileListWidget::addHistory(const FilesystemNode& node)
|
||||||
{
|
{
|
||||||
//while(_history.size() > _historyIndex)
|
if (_history.size() > 0) {
|
||||||
while(_currentHistory != std::prev(_history.end(), 1))
|
while(_currentHistory != std::prev(_history.end(), 1))
|
||||||
_history.pop_back();
|
_history.pop_back();
|
||||||
|
|
||||||
string select = selected().getName();
|
string select = selected().getName();
|
||||||
_currentHistory->selected = fixPath(select);
|
_currentHistory->selected = fixPath(select);
|
||||||
|
}
|
||||||
|
|
||||||
_history.emplace_back(node, "..");
|
_history.emplace_back(node, "..");
|
||||||
_currentHistory = std::prev(_history.end(), 1);
|
_currentHistory = std::prev(_history.end(), 1);
|
||||||
//_historyIndex++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
Loading…
Reference in New Issue