mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-01 00:09:58 -05:00
Prevent crash when accessing a layer name after it has been deleted (closes #3283)
This commit is contained in:
@@ -177,12 +177,15 @@ void LayerGroup::deleteLayer(const std::string& layerName) {
|
||||
layerGroup->identifier(),
|
||||
it->get()->identifier()
|
||||
);
|
||||
// We need to keep the name of the layer since we only get it as a reference
|
||||
// and the name needs to survive the deletion
|
||||
const std::string lName = layerName;
|
||||
_layers.erase(it);
|
||||
update();
|
||||
if (_onChangeCallback) {
|
||||
_onChangeCallback(nullptr);
|
||||
}
|
||||
LINFO("Deleted layer " + layerName);
|
||||
LINFO(std::format("Deleted layer {}", lName));
|
||||
|
||||
if (_layers.empty()) {
|
||||
_levelBlendingEnabled.setVisibility(
|
||||
|
||||
Reference in New Issue
Block a user