Util: Fix a null-pointer issue when attempting to delete a key

This commit is contained in:
Jeffrey Pfau 2015-05-02 01:08:29 -07:00
parent f8675a9004
commit 5080a29341
2 changed files with 9 additions and 4 deletions

View File

@ -24,6 +24,7 @@ Bugfixes:
- Debugger: Fix boundary conditions in tab completion
- Video: Fix an issue with very long filenames
- SDL: Fix boundary conditions for joystick adjustments
- Util: Fix a null-pointer issue when attempting to delete a key
Misc:
- Qt: Show multiplayer numbers in window title
- Qt: Solar sensor can have shortcuts set

View File

@ -53,10 +53,14 @@ void ConfigurationSetValue(struct Configuration* configuration, const char* sect
struct Table* currentSection = &configuration->root;
if (section) {
currentSection = HashTableLookup(&configuration->sections, section);
if (!currentSection && value) {
currentSection = malloc(sizeof(*currentSection));
HashTableInit(currentSection, 0, _sectionDeinit);
HashTableInsert(&configuration->sections, section, currentSection);
if (!currentSection) {
if (value) {
currentSection = malloc(sizeof(*currentSection));
HashTableInit(currentSection, 0, _sectionDeinit);
HashTableInsert(&configuration->sections, section, currentSection);
} else {
return;
}
}
}
if (value) {