aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_vulkan_cpp_demo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pugl_vulkan_cpp_demo.cpp')
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index a1d6954..52976e6 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -715,7 +715,12 @@ readFile(const char* const programPath, const std::string& filename)
}
fseek(file.get(), 0, SEEK_END);
- const auto fileSize = static_cast<size_t>(ftell(file.get()));
+ const auto filePos = ftell(file.get());
+ if (filePos <= 0) {
+ return {};
+ }
+
+ const auto fileSize = static_cast<size_t>(filePos);
fseek(file.get(), 0, SEEK_SET);
const auto numWords = fileSize / sizeof(uint32_t);