mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-26 16:09:10 +00:00
(svn r19095) -Fix: segfault when a baseset has an empty metadata field
This commit is contained in:
@@ -24,7 +24,7 @@ template <class Tbase_set> /* static */ Tbase_set *BaseMedia<Tbase_set>::availab
|
||||
*/
|
||||
#define fetch_metadata(name) \
|
||||
item = metadata->GetItem(name, false); \
|
||||
if (item == NULL || strlen(item->value) == 0) { \
|
||||
if (item == NULL || StrEmpty(item->value)) { \
|
||||
DEBUG(grf, 0, "Base " SET_TYPE "set detail loading: %s field missing", name); \
|
||||
return false; \
|
||||
}
|
||||
|
@@ -56,17 +56,6 @@ template <class Tbase_set>
|
||||
return BaseMedia<Tbase_set>::used_set != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to read a single piece of metadata and return false if it doesn't exist.
|
||||
* @param name the name of the item to fetch.
|
||||
*/
|
||||
#define fetch_name(name) \
|
||||
item = metadata->GetItem(name, false); \
|
||||
if (item == NULL || strlen(item->value) == 0) { \
|
||||
DEBUG(grf, 0, "Base " SET_TYPE "set detail loading: %s field missing", name); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
bool MusicSet::FillSetDetails(IniFile *ini, const char *path)
|
||||
{
|
||||
bool ret = this->BaseSet<MusicSet, NUM_SONGS_AVAILABLE, GM_DIR>::FillSetDetails(ini, path);
|
||||
@@ -81,7 +70,7 @@ bool MusicSet::FillSetDetails(IniFile *ini, const char *path)
|
||||
}
|
||||
|
||||
IniItem *item = names->GetItem(filename, false);
|
||||
if (item == NULL || strlen(item->value) == 0) {
|
||||
if (item == NULL || StrEmpty(item->value)) {
|
||||
DEBUG(grf, 0, "Base music set song name missing: %s", filename);
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user