Skip to content

Commit

Permalink
Merge pull request #19 from Pattonville-Robotics/opencv-fixes
Browse files Browse the repository at this point in the history
added null check to prevent crash
  • Loading branch information
greg-bahr committed Nov 2, 2017
2 parents 0efa29a + f2ad72d commit 0db1dae
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 0db1dae

Please sign in to comment.