# HG changeset patch # User Sebastien Jodogne # Date 1555598065 -7200 # Node ID a29f9628369ee9f55ee82d96cf6db52d4f3639a0 # Parent 943f9fb02496aa2aadeb97926faa1653696332d8 fix build on visual studio 2008 diff -r 943f9fb02496 -r a29f9628369e Framework/Radiography/RadiographyScene.cpp --- a/Framework/Radiography/RadiographyScene.cpp Thu Apr 18 14:54:33 2019 +0200 +++ b/Framework/Radiography/RadiographyScene.cpp Thu Apr 18 16:34:25 2019 +0200 @@ -199,24 +199,37 @@ { LOG(INFO) << "Removing layer: " << layerIndex; - if (layerIndex > countLayers_) + Layers::iterator found = layers_.find(layerIndex); + + if (found == layers_.end()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } - delete layers_[layerIndex]; - layers_.erase(layerIndex); - countLayers_--; - LOG(INFO) << "Removing layer, there are now : " << countLayers_ << " layers"; + else + { + assert(found->second != NULL); + delete found->second; + + layers_.erase(found); + countLayers_--; + + LOG(INFO) << "Removing layer, there are now : " << countLayers_ << " layers"; + } } const RadiographyLayer& RadiographyScene::GetLayer(size_t layerIndex) const { - if (layerIndex > countLayers_) + Layers::const_iterator found = layers_.find(layerIndex); + + if (found == layers_.end()) { throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); } - - return *(layers_.at(layerIndex)); + else + { + assert(found->second != NULL); + return *found->second; + } } bool RadiographyScene::GetWindowing(float& center,