Make image get function return std::optional if the image is not found

This commit is contained in:
Ylva Selling
2022-12-16 16:44:09 -05:00
parent 42f1b48372
commit 29fe0e7975
5 changed files with 17 additions and 13 deletions

View File

@@ -319,8 +319,11 @@ void SkyBrowserModule::setHoverCircle(SceneGraphNode* circle) {
}
void SkyBrowserModule::moveHoverCircle(const std::string& imageUrl, bool useScript) {
const ImageData& image = _dataHandler.image(imageUrl);
std::optional<const ImageData> found = _dataHandler.image(imageUrl);
if (!found.has_value()) {
return;
}
const ImageData image = found.value();
// Only move and show circle if the image has coordinates
if (!(_hoverCircle && image.hasCelestialCoords && _isCameraInSolarSystem)) {
return;