Fix editor crash when showing explanation for custom entities

The failing assertion is removed because users can add custom entities images besides the predefined ones.

Reported by Mr.Gh0s7 on Discord.
This commit is contained in:
Robert Müller 2023-11-09 18:51:37 +01:00
parent 670f4e167a
commit df664261bb
3 changed files with 5 additions and 2 deletions

View file

@ -2549,7 +2549,7 @@ void CEditor::DoMapEditor(CUIRect View)
else
Layer = NUM_LAYERS;
EExplanation Explanation = EExplanation::DDNET;
EExplanation Explanation;
if(m_SelectEntitiesImage == "DDNet")
Explanation = EExplanation::DDNET;
else if(m_SelectEntitiesImage == "FNG")
@ -2561,7 +2561,7 @@ void CEditor::DoMapEditor(CUIRect View)
else if(m_SelectEntitiesImage == "blockworlds")
Explanation = EExplanation::BLOCKWORLDS;
else
dbg_assert(false, "Unhandled entities image for explanations");
Explanation = EExplanation::NONE;
if(Layer != NUM_LAYERS)
{

View file

@ -951,6 +951,7 @@ public:
// Explanations
enum class EExplanation
{
NONE,
DDNET,
FNG,
RACE,

View file

@ -670,6 +670,8 @@ const char *CEditor::Explain(EExplanation Explanation, int Tile, int Layer)
{
switch(Explanation)
{
case EExplanation::NONE:
return nullptr;
case EExplanation::DDNET:
return ExplainDDNet(Tile, Layer);
case EExplanation::FNG: