Skip to content

Commit

Permalink
fix(int): Simplify test and make static analysis happy
Browse files Browse the repository at this point in the history
The prior test was redundant. Since a few lines above, if B was an
image but A was not, we swapped to ensure that A was always an
image. So here, we can just test A to know for sure that at least one
of them is an image. That makes the test here simpler, but it also
makes it more clear to static analysis that from this point forward, A
can't be nullptr.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz committed Jan 8, 2024
1 parent b511d2c commit e199a55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libOpenImageIO/imagebufalgo_mad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ ImageBufAlgo::mad(ImageBuf& dst, Image_or_Const A_, Image_or_Const B_,
A_.swap(B_);
// Get pointers to any image. At least one of A or B must be an image.
const ImageBuf *A = A_.imgptr(), *B = B_.imgptr(), *C = C_.imgptr();
if (!A && !B) {
if (!A) {
dst.errorfmt(
"ImageBufAlgo::mad(): at least one of the first two arguments must be an image");
return false;
Expand Down

0 comments on commit e199a55

Please sign in to comment.