diff options
Diffstat (limited to 'src/script/api/script_town.cpp')
-rw-r--r-- | src/script/api/script_town.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp index 29183aa89..fb5589707 100644 --- a/src/script/api/script_town.cpp +++ b/src/script/api/script_town.cpp @@ -58,9 +58,11 @@ { CCountedPtr<Text> counter(text); - EnforcePrecondition(false, text != nullptr); - const char *encoded_text = text->GetEncodedText(); - EnforcePreconditionEncodedText(false, encoded_text); + const char *encoded_text = nullptr; + if (text != nullptr) { + encoded_text = text->GetEncodedText(); + EnforcePreconditionEncodedText(false, encoded_text); + } EnforcePrecondition(false, IsValidTown(town_id)); return ScriptObject::DoCommand(::Town::Get(town_id)->xy, town_id, 0, CMD_TOWN_SET_TEXT, encoded_text); |