mirror of https://github.com/OpenTTD/OpenTTD
(svn r16507) -Fix (r16503): segfault when deleting non-last graphics set
parent
2b4d37de3d
commit
d1a50f5258
|
@ -459,8 +459,8 @@ bool OBGFileScanner::AddFile(const char *filename, size_t basepath_length)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FillGraphicsSetDetails(graphics, ini, path)) {
|
if (FillGraphicsSetDetails(graphics, ini, path)) {
|
||||||
const GraphicsSet *duplicate = NULL;
|
GraphicsSet *duplicate = NULL;
|
||||||
for (const GraphicsSet *c = _available_graphics_sets; c != NULL; c = c->next) {
|
for (GraphicsSet *c = _available_graphics_sets; c != NULL; c = c->next) {
|
||||||
if (strcmp(c->name, graphics->name) == 0 || c->shortname == graphics->shortname) {
|
if (strcmp(c->name, graphics->name) == 0 || c->shortname == graphics->shortname) {
|
||||||
duplicate = c;
|
duplicate = c;
|
||||||
break;
|
break;
|
||||||
|
@ -476,6 +476,8 @@ bool OBGFileScanner::AddFile(const char *filename, size_t basepath_length)
|
||||||
|
|
||||||
*prev = graphics;
|
*prev = graphics;
|
||||||
graphics->next = duplicate->next;
|
graphics->next = duplicate->next;
|
||||||
|
/* don't allow recursive delete of all remaining items */
|
||||||
|
duplicate->next = NULL;
|
||||||
|
|
||||||
DEBUG(grf, 1, "Removing %s (%i) as base graphics set (duplicate)", duplicate->name, duplicate->version);
|
DEBUG(grf, 1, "Removing %s (%i) as base graphics set (duplicate)", duplicate->name, duplicate->version);
|
||||||
delete duplicate;
|
delete duplicate;
|
||||||
|
|
Loading…
Reference in New Issue