Changeset - r7511:5e4abeb6880a
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-08-31 20:50:59
rubidium@openttd.org
(svn r11026) -Fix: the name of a sign could sometimes be NULL causing crashes.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/signs.cpp
Show inline comments
 
@@ -10,12 +10,13 @@
 
#include "landscape.h"
 
#include "player.h"
 
#include "signs.h"
 
#include "saveload.h"
 
#include "command.h"
 
#include "variables.h"
 
#include "string.h"
 
#include "misc/autoptr.hpp"
 

	
 
SignID _new_sign_id;
 
uint _total_signs;
 

	
 
/* Initialize the sign-pool */
 
@@ -125,13 +126,13 @@ CommandCost CmdPlaceSign(TileIndex tile,
 
CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	if (!IsValidSignID(p1)) return CMD_ERROR;
 

	
 
	/* 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 */
 
	if (_cmd_text[0] != '\0') {
 
	if (!StrEmpty(_cmd_text)) {
 
		/* Create the name */
 
		StringID str = AllocateName(_cmd_text, 0);
 
		if (str == 0) return CMD_ERROR;
 

	
 
		if (flags & DC_EXEC) {
 
			Sign *si = GetSign(p1);
0 comments (0 inline, 0 general)