diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2013-08-02 15:49:28 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-08-08 13:31:09 -0400 |
commit | 00ce12a3347d1fef25badff00c5abc3dc715f207 (patch) | |
tree | 9033b85c5ab80cb9c272a02bdf8bb1c8476512b3 /Source/cmVariableWatch.cxx | |
parent | 34b397e8dec04c55b415ee0e5f9172f624156d36 (diff) | |
download | cmake-00ce12a3347d1fef25badff00c5abc3dc715f207.tar.gz |
variable_watch: Prevent making extra entries in the watch map
When removing a watch on a variable, using the operator [] on the
internal map will create an empty watch if the variable doesn't have any
existing watches. Rather than creating this empty structure in the map,
return if there isn't a watch on the variable already.
Diffstat (limited to 'Source/cmVariableWatch.cxx')
-rw-r--r-- | Source/cmVariableWatch.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx index d049cddeac..8ad6fce8f3 100644 --- a/Source/cmVariableWatch.cxx +++ b/Source/cmVariableWatch.cxx @@ -80,6 +80,10 @@ void cmVariableWatch::RemoveWatch(const std::string& variable, WatchMethod method, void* client_data /*=0*/) { + if ( !this->WatchMap.count(variable) ) + { + return; + } cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable]; cmVariableWatch::VectorOfPairs::iterator it; for ( it = vp->begin(); it != vp->end(); ++it ) |