vo_opengl: don't assume imgfmt=0 is valid

Could cause a crash if anything called ra_get_imgfmt_desc(imgfmt=0). Let
it fail correctly. This can happen if a hwdec backend does not set
hw_subfmt correctly.
This commit is contained in:
wm4 committed 2017-08-29 15:05:32 +02:00
1 parent cc79d48d22
commit a46500a2c8
1 file changed
+1 -1
+1 -1
View File
@@ -230,7 +230,7 @@ bool ra_get_imgfmt_desc(struct ra *ra, int imgfmt, struct ra_imgfmt_desc *out)
}
for (int n = 0; n < ra->num_formats; n++) {
if (ra->formats[n]->special_imgfmt == imgfmt) {
if (imgfmt && ra->formats[n]->special_imgfmt == imgfmt) {
res = *ra->formats[n]->special_imgfmt_desc;
goto supported;
}