summaryrefslogtreecommitdiff
path: root/tests/util/shader-load.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util/shader-load.c')
-rw-r--r--tests/util/shader-load.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/util/shader-load.c b/tests/util/shader-load.c
index e4004c2f5..c26f98ad9 100644
--- a/tests/util/shader-load.c
+++ b/tests/util/shader-load.c
@@ -87,7 +87,10 @@ char *piglit_load_text_file(const char *file_name, unsigned *size)
}
} while (total_read < len);
- text[total_read] = '\0';
+ if (text != NULL) {
+ text[total_read] = '\0';
+ }
+
if (size != NULL) {
*size = total_read;
}