From 52de41294e07cf5b8bf8cbdb41440e566c2cf435 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sun, 24 Sep 2023 18:48:29 -0600 Subject: [PATCH] Assert against invalid function name In testing I tried passing `nullptr` to this function which caused a segfault on Linux. If we know that's an invalid input then lets assert against it. --- src/SFML/Window/Vulkan.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SFML/Window/Vulkan.cpp b/src/SFML/Window/Vulkan.cpp index 772f828be..49fff1d16 100644 --- a/src/SFML/Window/Vulkan.cpp +++ b/src/SFML/Window/Vulkan.cpp @@ -27,6 +27,8 @@ //////////////////////////////////////////////////////////// #include +#include + #if defined(SFML_SYSTEM_WINDOWS) #include @@ -73,6 +75,8 @@ bool Vulkan::isAvailable([[maybe_unused]] bool requireGraphics) //////////////////////////////////////////////////////////// VulkanFunctionPointer Vulkan::getFunction([[maybe_unused]] const char* name) { + assert(name && "Name cannot be a null pointer"); + #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) return nullptr;