mirror of https://github.com/mgba-emu/mgba.git
GBA Config: Fix null ports from crashing
This commit is contained in:
parent
9176260044
commit
a1829a920d
|
@ -90,8 +90,12 @@ static bool _lookupFloatValue(const struct GBAConfig* config, const char* key, f
|
|||
void GBAConfigInit(struct GBAConfig* config, const char* port) {
|
||||
ConfigurationInit(&config->configTable);
|
||||
ConfigurationInit(&config->defaultsTable);
|
||||
config->port = malloc(strlen("ports.") + strlen(port) + 1);
|
||||
snprintf(config->port, strlen("ports.") + strlen(port) + 1, "ports.%s", port);
|
||||
if (port) {
|
||||
config->port = malloc(strlen("ports.") + strlen(port) + 1);
|
||||
snprintf(config->port, strlen("ports.") + strlen(port) + 1, "ports.%s", port);
|
||||
} else {
|
||||
config->port = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GBAConfigDeinit(struct GBAConfig* config) {
|
||||
|
|
Loading…
Reference in New Issue