summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/imgconvert.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 0abe6cdf48..2402718b1f 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -84,11 +84,12 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p
int loss;
for (i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) {
- loss = *loss_ptr;
+ loss = loss_ptr ? *loss_ptr : 0;
best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, &loss);
}
- *loss_ptr = loss;
+ if (loss_ptr)
+ *loss_ptr = loss;
return best;
}