summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/debug.c')
-rw-r--r--src/mesa/main/debug.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 7b76a949698..d7e0143a8f6 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -235,6 +235,11 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height,
fprintf(f,"255\n");
fclose(f);
f = fopen( filename, "ab" ); /* reopen in binary append mode */
+ if (!f) {
+ fprintf(stderr, "Error while reopening %s in write_ppm()\n",
+ filename);
+ return;
+ }
for (y=0; y < height; y++) {
for (x = 0; x < width; x++) {
int yy = invert ? (height - 1 - y) : y;