Skip to content

Commit

Permalink
added null check to prevent crash
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-bahr committed Nov 2, 2017
1 parent 0efa29a commit f2ad72d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void findJewelContours() {
}
}
}
if (redJewel == null) {
if (redJewel == null && Contour.findLargestContour(redDetector.getContours()) != null) {
Point center = Contour.centroid(Contour.findLargestContour(redDetector.getContours()));
redJewel = new Vector3D(center.x, center.y, 20);
}
Expand All @@ -82,7 +82,7 @@ private void findJewelContours() {
}
}
}
if (blueJewel == null) {
if (blueJewel == null && Contour.findLargestContour(redDetector.getContours()) != null) {
Point center = Contour.centroid(Contour.findLargestContour(redDetector.getContours()));
blueJewel = new Vector3D(center.x, center.y, 20);
}
Expand Down

0 comments on commit f2ad72d

Please sign in to comment.