From 9f66b1e8ff76b40580c4d9248f2bbd65c0a65ec2 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Wed, 25 Oct 2023 01:16:39 +0200 Subject: [PATCH] Don't assert on config input. assert() is not a good way to handle incorrect user input, It is a debugging tool that should only be used for conditions that the program guarantees to be true (unless there a is a bug in the c++ code). --- src/ai/simulated_actions.cpp | 2 +- src/gui/core/canvas.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ai/simulated_actions.cpp b/src/ai/simulated_actions.cpp index ebcba3fe812..b7568df2154 100644 --- a/src/ai/simulated_actions.cpp +++ b/src/ai/simulated_actions.cpp @@ -250,7 +250,7 @@ void helper_advance_unit(const map_location& loc){ const unit_type *advanced_type = unit_types.find(advance_unit_typename); if(!advanced_type) { ERR_AI_SIM_ACTIONS << "Simulating advancing to unknown unit type: " << advance_unit_typename; - assert(false && "simulating to unknown unit type"); + return; } advanced_unit->set_experience(advanced_unit->experience_overflow()); advanced_unit->advance_to(*advanced_type); diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index f7dfff9f61b..277196c9ee1 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -634,8 +634,6 @@ void canvas::parse_cfg(const config& cfg) } else { ERR_GUI_P << "Canvas: found a shape of an invalid type " << type << "."; - - assert(false); } } }