Do not assume that the GuiName or a DashboardItem is provided (closes #1006)

Do not try to load an empty URL as it triggers an assert
This commit is contained in:
Alexander Bock
2019-12-27 20:10:48 +01:00
parent 0ea77f56c3
commit ce7795a67b
2 changed files with 7 additions and 3 deletions

View File

@@ -103,7 +103,9 @@ void CefWebGuiModule::startOrStopGui() {
new GUIKeyboardHandler
);
_instance->initialize();
_instance->loadUrl(_url);
if (!_url.value().empty()) {
_instance->loadUrl(_url);
}
}
if (_visible) {
webBrowserModule->attachEventHandler(_instance.get());

View File

@@ -111,8 +111,10 @@ DashboardItem::DashboardItem(const ghoul::Dictionary& dictionary)
std::string identifier = dictionary.value<std::string>(IdentifierInfo.identifier);
setIdentifier(std::move(identifier));
std::string guiName = dictionary.value<std::string>(GuiNameInfo.identifier);
setGuiName(std::move(guiName));
if (dictionary.hasKeyAndValue<std::string>(GuiNameInfo.identifier)) {
std::string guiName = dictionary.value<std::string>(GuiNameInfo.identifier);
setGuiName(std::move(guiName));
}
addProperty(_isEnabled);
}