1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Fix accessing nullopt type if nullopt

This commit is contained in:
Elias Steurer 2023-01-29 13:39:40 +01:00
parent d53dd498bb
commit b1986ecd04

View File

@ -35,8 +35,8 @@ bool ProjectFile::init()
return false;
auto typeParsed = ScreenPlayUtil::getInstalledTypeFromString(obj.value("type").toString());
if (!typeParsed) {
qWarning() << "Type could not parsed from: " << *typeParsed;
if (!typeParsed.has_value()) {
qWarning() << "Type could not parsed from string: " << obj.value("type").toString();
return false;
}
type = typeParsed.value();
@ -87,6 +87,8 @@ bool ProjectFile::init()
if (obj.contains("codec")) {
if (auto videoCodecOpt = ScreenPlayUtil::getVideoCodecFromString(obj.value("codec").toString())) {
videoCodec = videoCodecOpt.value();
} else{
qWarning("Invalid videoCodec was specified inside the json object!");
}
} else if (type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) {
qWarning("No videoCodec was specified inside the json object!");