Protect against crash when changing colormaps (#2082)

This commit is contained in:
Micah Acinapura
2022-05-06 08:52:32 -04:00
committed by GitHub
parent ec51ffca05
commit bdda36b41e
2 changed files with 24 additions and 3 deletions
+16 -2
View File
@@ -619,7 +619,14 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
_colorOption.onChange([&] { _dataIsDirty = true; });
addProperty(_colorOption);
_colorTexturePath.onChange([&] { _colorTextureIsDirty = true; });
_colorTexturePath.onChange([&] {
if (std::filesystem::exists(_colorTexturePath.value())) {
_colorTextureIsDirty = true;
}
else {
LWARNING(fmt::format("File not found: {}", _colorTexturePath));
}
});
_colorTextureFile->setCallback([this]() { _colorTextureIsDirty = true; });
addProperty(_colorTexturePath);
@@ -632,7 +639,14 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
addProperty(_otherDataRange);
addProperty(_otherDataColorMapPath);
_otherDataColorMapPath.onChange([&]() { _otherDataColorMapIsDirty = true; });
_otherDataColorMapPath.onChange([&]() {
if (std::filesystem::exists(_otherDataColorMapPath.value())) {
_otherDataColorMapIsDirty = true;
}
else {
LWARNING(fmt::format("File not found: {}", _otherDataColorMapPath));
}
});
_staticFilterValue = p.staticFilter;
_staticFilterReplacementValue =