FtcRobotController icon indicating copy to clipboard operation
FtcRobotController copied to clipboard

Missing null check on ColourBlobLocatorProcessor.Builder imageRegion

Open bubner opened this issue 5 months ago • 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().

bubner avatar Sep 21 '24 04:09 bubner