From eceff0fc031a6c643762f165640e23e6bd3af664 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Tue, 31 Mar 2015 09:48:26 +0000
Subject: [PATCH] Segmentation: setDecoder * protect against self assignment *
 delete NULL is a no-op, don't need to check

---
 DDSegmentation/src/Segmentation.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/DDSegmentation/src/Segmentation.cpp b/DDSegmentation/src/Segmentation.cpp
index b284acc56..6f3dbf6f5 100644
--- a/DDSegmentation/src/Segmentation.cpp
+++ b/DDSegmentation/src/Segmentation.cpp
@@ -86,7 +86,8 @@ void Segmentation::neighbours(const CellID& cID, std::set<CellID>& cellNeighbour
 
 /// Set the underlying decoder
 void Segmentation::setDecoder(BitField64* newDecoder) {
-	if (_ownsDecoder and _decoder != 0) {
+	if ( _decoder == newDecoder ) return; //self assignment
+	if (_ownsDecoder) {
 		delete _decoder;
 	}
 	_decoder = newDecoder;
-- 
GitLab