From 62c903b7be5653216d9b0fa366c055a93ecf5407 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 21 Sep 2015 19:25:20 -0400 Subject: [PATCH] search: Fix crash when disabling a stockpile category Closes #678 --- NEWS | 4 +++- plugins/search.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 425f514ac..adda9fd20 100644 --- a/NEWS +++ b/NEWS @@ -54,7 +54,9 @@ DFHack Future help: now recognizes built-in commands, like "help" manipulator: fixed crash when selecting custom professions when none are found remotefortressreader: fixed crash when attempting to send map info when no map was loaded - search: fixed crash in unit list after cancelling a job + search: + - fixed crash in unit list after cancelling a job + - fixed crash when disabling stockpile category after searching in a subcategory stockpiles: now checks/sanitizes filenames when saving stocks: fixed a crash when right-clicking steam-engine: diff --git a/plugins/search.cpp b/plugins/search.cpp index 7877bc207..6d12e922c 100644 --- a/plugins/search.cpp +++ b/plugins/search.cpp @@ -1262,7 +1262,17 @@ public: return &viewscreen->item_status; } + bool should_check_input(set *input) + { + if (input->count(interface_key::STOCKPILE_SETTINGS_DISABLE) && !in_entry_mode() && !search_string.empty()) + { + // Restore original list + clear_search(); + reset_all(); + } + return true; + } };