From b1986ecd04ee1d37d37d7fa544d92f323e8cf6ec Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 29 Jan 2023 13:39:40 +0100 Subject: [PATCH] Fix accessing nullopt type if nullopt --- ScreenPlayUtil/src/projectfile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ScreenPlayUtil/src/projectfile.cpp b/ScreenPlayUtil/src/projectfile.cpp index 4b735168..f66b76b4 100644 --- a/ScreenPlayUtil/src/projectfile.cpp +++ b/ScreenPlayUtil/src/projectfile.cpp @@ -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!");