diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 2002928fe..bd3c548ac 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -85,6 +85,7 @@ TEST(stdio, getdelim) {
 
 TEST(stdio, getdelim_invalid) {
   FILE* fp = tmpfile();
+  ASSERT_TRUE(fp != NULL);
 
   char* buffer = NULL;
   size_t buffer_length = 0;
@@ -153,6 +154,7 @@ TEST(stdio, getline) {
 
 TEST(stdio, getline_invalid) {
   FILE* fp = tmpfile();
+  ASSERT_TRUE(fp != NULL);
 
   char* buffer = NULL;
   size_t buffer_length = 0;