mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
play around with the QString json deserializer
This commit is contained in:
parent
7f589803be
commit
5724c7ef67
|
@ -73,6 +73,10 @@ bool getSafe(const rapidjson::Value &obj, const char *key, Type &out)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (obj.IsNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
out = pajlada::Settings::Deserialize<Type>::get(obj[key]);
|
||||
} catch (const std::runtime_error &) {
|
||||
|
|
|
@ -24,7 +24,18 @@ struct Deserialize<QString> {
|
|||
throw std::runtime_error("Deserialized rapidjson::Value is not a string");
|
||||
}
|
||||
|
||||
return value.GetString();
|
||||
try {
|
||||
const char *str = value.GetString();
|
||||
auto strLen = value.GetStringLength();
|
||||
|
||||
return QString::fromUtf8(str, strLen);
|
||||
} catch (const std::exception &e) {
|
||||
int x = 5;
|
||||
} catch (...) {
|
||||
int y = 5;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue