mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Return nullptr
when sf::Context::getFunction
is called on Windows without an active context
This converts termination in Debug and a SEGFAULT in Release builds into defined behavior.
This commit is contained in:
parent
49cf5058e5
commit
d00ab43ea6
@ -131,6 +131,9 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the address of an OpenGL function
|
||||
///
|
||||
/// On Windows when not using OpenGL ES, a context must be
|
||||
/// active for this function to succeed.
|
||||
///
|
||||
/// \param name Name of the function to get the address of
|
||||
///
|
||||
/// \return Address of the OpenGL function, 0 on failure
|
||||
|
@ -203,8 +203,8 @@ WglContext::~WglContext()
|
||||
////////////////////////////////////////////////////////////
|
||||
GlFunctionPointer WglContext::getFunction(const char* name)
|
||||
{
|
||||
assert(WglContextImpl::currentContext != nullptr &&
|
||||
"Current WGL context cannot be null. Call WglContext::makeCurrent() to initialize it.");
|
||||
if (WglContextImpl::currentContext == nullptr)
|
||||
return nullptr;
|
||||
|
||||
// If we are using the generic GDI implementation, skip to loading directly from OpenGL32.dll since it doesn't support extensions
|
||||
if (!WglContextImpl::currentContext->m_isGeneric)
|
||||
|
Loading…
Reference in New Issue
Block a user