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.
This commit is contained in:
Chris Thrasher 2023-09-24 18:48:29 -06:00
parent 3750074238
commit 52de41294e

View File

@ -27,6 +27,8 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/Window/Vulkan.hpp> #include <SFML/Window/Vulkan.hpp>
#include <cassert>
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
#include <SFML/Window/Win32/VulkanImplWin32.hpp> #include <SFML/Window/Win32/VulkanImplWin32.hpp>
@ -73,6 +75,8 @@ bool Vulkan::isAvailable([[maybe_unused]] bool requireGraphics)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
VulkanFunctionPointer Vulkan::getFunction([[maybe_unused]] const char* name) VulkanFunctionPointer Vulkan::getFunction([[maybe_unused]] const char* name)
{ {
assert(name && "Name cannot be a null pointer");
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
return nullptr; return nullptr;