How do I fix "Returning null reference (within a call to 'at')" logic error found by Xcode 5 Analyzer?
Here's my scenario:
Using Xcode/Product/Analyze I get the following error on the value = mat.at line below:
Logic error: Returning null reference (within a call to 'at')
int SomeFunction(const cv::Mat& mat)
{
float value;
for (int i=0; i<rows; i++)
{
for (int j-0; j<cols; j++)
{
value = mat.at<uint8_t>(i,j);
// code that uses the value
}
}
}