fix more errors
[imago.git] / src / intrsc.py
index 355468c..a740212 100644 (file)
@@ -162,6 +162,8 @@ def stone_color_raw(image, (x, y)):
             except IndexError:
                 pass
     norm = float(len(points))
+    if norm == 0:
+        return 0, 0, (0, 0, 0) #TODO trow exception here
     color = (sum(p[0] for p in points) / norm,
              sum(p[1] for p in points) / norm,
              sum(p[2] for p in points) / norm)