mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Prevent some crashes when title sequence is not present
This commit is contained in:
committed by
Ted John
parent
f6cc743da6
commit
723e13cb16
@@ -82,6 +82,10 @@ namespace TitleSequenceManager
|
||||
void DeleteItem(size_t i)
|
||||
{
|
||||
auto item = GetItem(i);
|
||||
if (item == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const utf8 * path = item->Path.c_str();
|
||||
if (item->IsZip)
|
||||
{
|
||||
@@ -295,6 +299,10 @@ extern "C"
|
||||
const utf8 * title_sequence_manager_get_name(size_t index)
|
||||
{
|
||||
auto item = TitleSequenceManager::GetItem(index);
|
||||
if (item == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
const utf8 * name = item->Name.c_str();
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ static void window_title_editor_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
}
|
||||
break;
|
||||
case WIDX_TITLE_EDITOR_DUPLICATE_BUTTON:
|
||||
if (!commandEditorOpen) {
|
||||
if (!commandEditorOpen && _editingTitleSequence != NULL) {
|
||||
window_text_input_open(w, widgetIndex, STR_TITLE_EDITOR_ACTION_DUPLICATE, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uintptr_t)_editingTitleSequence->Name, 64);
|
||||
}
|
||||
break;
|
||||
@@ -324,7 +324,7 @@ static void window_title_editor_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
}
|
||||
break;
|
||||
case WIDX_TITLE_EDITOR_RENAME_SAVE_BUTTON:
|
||||
if (window_title_editor_check_can_edit()) {
|
||||
if (window_title_editor_check_can_edit() && _editingTitleSequence != NULL) {
|
||||
window_text_input_open(w, widgetIndex, STR_TRACK_MANAGE_RENAME, STR_TITLE_EDITOR_ENTER_NAME_FOR_SEQUENCE, STR_STRING, (uintptr_t)_editingTitleSequence->Name, 64);
|
||||
}
|
||||
break;
|
||||
@@ -802,6 +802,9 @@ static void window_title_editor_scrollpaint_saves(rct_window *w, rct_drawpixelin
|
||||
|
||||
sint32 x = 0;
|
||||
sint32 y = 0;
|
||||
if (_editingTitleSequence == NULL) {
|
||||
return;
|
||||
}
|
||||
for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumSaves; i++, y += ROW_HEIGHT) {
|
||||
bool selected = false;
|
||||
bool hover = false;
|
||||
|
||||
Reference in New Issue
Block a user