mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 00:24:12 +00:00
Strip trailing spaces from field names.
A certain mod (glare at rogue) has a space at the end of a field name in the bsp entity data causing a crash. Thanks to ccr for the report.
This commit is contained in:
parent
6c0f271783
commit
4c6478c77f
1 changed files with 8 additions and 1 deletions
|
@ -305,7 +305,7 @@ ED_ConvertToPlist (script_t *script, int nohack)
|
||||||
plitem_t *ent;
|
plitem_t *ent;
|
||||||
plitem_t *key;
|
plitem_t *key;
|
||||||
plitem_t *value;
|
plitem_t *value;
|
||||||
const char *token;
|
char *token;
|
||||||
int anglehack;
|
int anglehack;
|
||||||
|
|
||||||
while (Script_GetToken (script, 1)) {
|
while (Script_GetToken (script, 1)) {
|
||||||
|
@ -314,11 +314,18 @@ ED_ConvertToPlist (script_t *script, int nohack)
|
||||||
Sys_Error ("ED_ConvertToPlist: EOF without closing brace");
|
Sys_Error ("ED_ConvertToPlist: EOF without closing brace");
|
||||||
ent = PL_NewDictionary ();
|
ent = PL_NewDictionary ();
|
||||||
while (1) {
|
while (1) {
|
||||||
|
int n;
|
||||||
|
|
||||||
if (!Script_GetToken (script, 1))
|
if (!Script_GetToken (script, 1))
|
||||||
Sys_Error ("ED_ConvertToPlist: EOF without closing brace");
|
Sys_Error ("ED_ConvertToPlist: EOF without closing brace");
|
||||||
token = script->token->str;
|
token = script->token->str;
|
||||||
if (strequal (token, "}"))
|
if (strequal (token, "}"))
|
||||||
break;
|
break;
|
||||||
|
// hack to take care of trailing spaces in field names
|
||||||
|
// (looking at you, Rogue)
|
||||||
|
for (n = strlen (token); n && token[n - 1] == ' '; n--) {
|
||||||
|
token[n - 1] = 0;
|
||||||
|
}
|
||||||
anglehack = 0;
|
anglehack = 0;
|
||||||
if (!nohack && strequal (token, "angle")) {
|
if (!nohack && strequal (token, "angle")) {
|
||||||
key = PL_NewString ("angles");
|
key = PL_NewString ("angles");
|
||||||
|
|
Loading…
Reference in a new issue