mirror of
https://github.com/mariiaan/minipp.git
synced 2026-05-14 10:11:17 +02:00
Improve type safety in GetValueOrDefault
This commit is contained in:
@@ -272,7 +272,10 @@ namespace minipp
|
||||
ValueDataType* value = nullptr;
|
||||
if (GetValue(key, &value) != EResult::Success)
|
||||
return defaultValue;
|
||||
return value->GetValue();
|
||||
auto casted = dynamic_cast<ValueDataType*>(value);
|
||||
if (casted == nullptr)
|
||||
return defaultValue;
|
||||
return casted->GetValue();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user