diff options
Diffstat (limited to 'examples/pugl_vulkan_cpp_demo.cpp')
-rw-r--r-- | examples/pugl_vulkan_cpp_demo.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp index 69f360d..c901de5 100644 --- a/examples/pugl_vulkan_cpp_demo.cpp +++ b/examples/pugl_vulkan_cpp_demo.cpp @@ -692,7 +692,10 @@ readFile(const char* const programPath, const std::string& filename) const auto numWords = fileSize / sizeof(uint32_t); std::vector<uint32_t> buffer(numWords); - fread(buffer.data(), sizeof(uint32_t), numWords, file.get()); + if (fread(buffer.data(), sizeof(uint32_t), numWords, file.get()) != + numWords) { + buffer.clear(); + } return buffer; } |