Skip to content

Commit

Permalink
fix crash when interpreting empty/missing animation frames
Browse files Browse the repository at this point in the history
  • Loading branch information
Walavouchey committed Mar 8, 2021
1 parent ace93de commit 77932cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ namespace sb
{
int depth = image.depth();
cv::Mat converted;
cv::cvtColor(image, converted, cv::COLOR_BGR2BGRA);
if (image.empty()) image = cv::Mat::zeros(1, 1, CV_8UC4);
else cv::cvtColor(image, converted, cv::COLOR_BGR2BGRA);
double scale = depth == CV_16U ? 1.0 / 257 : 1;
converted.convertTo(image, CV_32F, scale);
return image;
Expand All @@ -78,4 +79,4 @@ namespace sb
{
return convertImage(cv::imread(filepath, cv::IMREAD_UNCHANGED));
}
}
}

0 comments on commit 77932cd

Please sign in to comment.