Fixed bug with default variant selection in Insight window

The Insight window was failing to default to the first available variant
when the user provided an invalid variant name in their config file.
This commit is contained in:
Nav
2021-07-17 02:17:13 +01:00
parent 41c98bc5ba
commit 0e7c06bf87

View File

@@ -205,14 +205,18 @@ void InsightWindow::activate() {
if (this->supportedVariantsByName.contains(selectedVariantName)) {
// The user has specified a valid variant name in their config file, so use that as the default
this->selectVariant(&(this->supportedVariantsByName.at(selectedVariantName)));
}
} else {
if (this->targetConfig.variantName.has_value()) {
} else {
Logger::error("Invalid target variant name \"" + this->targetConfig.variantName.value()
+ "\" - no such variant with the given name was found.");
}
}
if (this->selectedVariant == nullptr) {
/*
* Given that we haven't been able to select a variant at this point, we will just fallback to the first
* one that is available.
*/
this->selectVariant(&(this->supportedVariantsByName.begin()->second));
}