FIRST-Tech-Challenge/FtcRobotController

Missing null check on ColourBlobLocatorProcessor.Builder imageRegion

bubner opened this issue · 1 comments

Hi, just reporting a small visual-level bug based on the builder of ColorBlobLocatorProcessor.

The region of interest parameter is not checked for being null when .build() is called, so instead of throwing a helpful message like You must set a region of interest! it throws:

java.lang.NullPointerException: Attempt to invoke virtual method 'org.opencv.core.Rect org.firstinspires.ftc.vision.opencv.ImageRegion.asOpenCvRect(int, int)' on a null object reference
   at org.firstinspires.ftc.vision.opencv.ColorBlobLocatorProcessorImpl.init(ColorBlobLocatorProcessorImpl.java:130)

The colour range and contour mode parameters are already checked when the processor is built to supply more helpful exception messages, so it would be helpful to more novice programmers to receive a more helpful exception if they forget to call setRoi().

Thanks for pointing this out, we'll fix it in the next release