From 220a1cf437901c3f73c9597fa9255ffa45868055 Mon Sep 17 00:00:00 2001
From: Marten Richter <marten.richter@freenet.de>
Date: Sat, 3 Nov 2012 08:22:05 +0100
Subject: [PATCH] Fix segfault in boxstack.cc

---
 boxstack.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/boxstack.cc b/boxstack.cc
index beb8280..5330003 100644
--- a/boxstack.cc
+++ b/boxstack.cc
@@ -281,6 +281,16 @@ void BoxStack::update(Boxx* toUpdate, Region* regionToUpdate)
     toUpdate = boxes[0];
   }
 
+  if (!toUpdate) {
+#ifndef WIN32
+	  pthread_mutex_unlock(&boxLock);
+#else
+	  ReleaseMutex(boxLock);
+#endif
+	  Log::getInstance()->log("BoxStack", Log::DEBUG, "Unlocked for update, no box present");
+	  return ;
+  }
+
   // get the region for the whole box, could be less than that
   // for smaller updates
 
-- 
2.39.5