mirror of https://github.com/OpenTTD/OpenTTD
(svn r11026) -Fix: the name of a sign could sometimes be NULL causing crashes.
parent
c720d9d83a
commit
10475e88c6
|
@ -13,6 +13,7 @@
|
||||||
#include "saveload.h"
|
#include "saveload.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
|
#include "string.h"
|
||||||
#include "misc/autoptr.hpp"
|
#include "misc/autoptr.hpp"
|
||||||
|
|
||||||
SignID _new_sign_id;
|
SignID _new_sign_id;
|
||||||
|
@ -128,7 +129,7 @@ CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
/* If _cmd_text 0 means the new text for the sign is non-empty.
|
/* If _cmd_text 0 means the new text for the sign is non-empty.
|
||||||
* So rename the sign. If it is empty, it has no name, so delete it */
|
* So rename the sign. If it is empty, it has no name, so delete it */
|
||||||
if (_cmd_text[0] != '\0') {
|
if (!StrEmpty(_cmd_text)) {
|
||||||
/* Create the name */
|
/* Create the name */
|
||||||
StringID str = AllocateName(_cmd_text, 0);
|
StringID str = AllocateName(_cmd_text, 0);
|
||||||
if (str == 0) return CMD_ERROR;
|
if (str == 0) return CMD_ERROR;
|
||||||
|
|
Loading…
Reference in New Issue