1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-02 19:39:12 +00:00

(svn r15385) -Fix: Saving of char* to configuration file did not work due to incorrect parameter order and no handling of NULL.

This commit is contained in:
2009-02-07 00:29:35 +00:00
parent eb533138bc
commit cd84ffb036

View File

@@ -567,7 +567,13 @@ static void ini_save_settings(IniFile *ini, const SettingDesc *sd, const char *g
case SLE_VAR_STRB: strcpy(buf, (char*)ptr); break;
case SLE_VAR_STRBQ:seprintf(buf, lastof(buf), "\"%s\"", (char*)ptr); break;
case SLE_VAR_STR: strcpy(buf, *(char**)ptr); break;
case SLE_VAR_STRQ: seprintf(buf, "\"%s\"", lastof(buf), *(char**)ptr); break;
case SLE_VAR_STRQ:
if (*(char**)ptr == NULL) {
buf[0] = '\0';
} else {
seprintf(buf, lastof(buf), "\"%s\"", *(char**)ptr);
}
break;
case SLE_VAR_CHAR: buf[0] = *(char*)ptr; buf[1] = '\0'; break;
default: NOT_REACHED();
}