Fix crash in SavePngTestOutput
Do not call SavePngTestOutput in CompareAndSaveImageOutput in case diff_img is null. This can happen if for instance the expected and the actual image have non-matching format or size. Currently, this crashes. Support single channel golden images. PiperOrigin-RevId: 552519834
This commit is contained in:
parent
d392f8ad98
commit
6f916a001c
|
@ -228,7 +228,9 @@ absl::Status CompareAndSaveImageOutput(
|
|||
auto status = CompareImageFrames(**expected, actual, options.max_color_diff,
|
||||
options.max_alpha_diff, options.max_avg_diff,
|
||||
diff_img);
|
||||
ASSIGN_OR_RETURN(auto diff_img_path, SavePngTestOutput(*diff_img, "diff"));
|
||||
if (diff_img) {
|
||||
ASSIGN_OR_RETURN(auto diff_img_path, SavePngTestOutput(*diff_img, "diff"));
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user