If key not found, strdup default value, too
This commit is contained in:
1 parent
3e2419ebe3
commit
fdead26ffe
1 file changed
+2
-6
@@ -453,14 +453,10 @@ METHOD(settings_t, alloc_str, char*,
|
|||||||
va_start(args, def);
|
va_start(args, def);
|
||||||
/* additional lock to savely strdup */
|
/* additional lock to savely strdup */
|
||||||
this->lock->read_lock(this->lock);
|
this->lock->read_lock(this->lock);
|
||||||
value = strdupnull(find_value(this, this->top, key, args));
|
value = strdupnull(find_value(this, this->top, key, args) ?: def);
|
||||||
this->lock->unlock(this->lock);
|
this->lock->unlock(this->lock);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
if (value)
|
return value;
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
return def;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user