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;
|
ValueDataType* value = nullptr;
|
||||||
if (GetValue(key, &value) != EResult::Success)
|
if (GetValue(key, &value) != EResult::Success)
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
return value->GetValue();
|
auto casted = dynamic_cast<ValueDataType*>(value);
|
||||||
|
if (casted == nullptr)
|
||||||
|
return defaultValue;
|
||||||
|
return casted->GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[game]
|
[game]
|
||||||
name = "Test Game\nNext Line"
|
name = "Test Game\nNext Line"
|
||||||
ver sion = "1.0.0"
|
version = "1.0.0"
|
||||||
year = 2025
|
year = 2025
|
||||||
completionPercentage = 50.0f
|
completionPercentage = 50.0f
|
||||||
# Should only be true if completionPercentage is 100
|
# Should only be true if completionPercentage is 100
|
||||||
|
|||||||
Reference in New Issue
Block a user