From c3e64230cbeee06eb6bcbdd24e7af925bb22ea0d Mon Sep 17 00:00:00 2001 From: Marco Antognini Date: Thu, 14 Jul 2011 09:59:20 +0200 Subject: [PATCH] OSX/Mouse::GetPosition(relativeTo) no longer complains when the window is closed --- src/SFML/Window/OSX/InputImpl.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SFML/Window/OSX/InputImpl.mm b/src/SFML/Window/OSX/InputImpl.mm index 62fe7ee3..02880be5 100644 --- a/src/SFML/Window/OSX/InputImpl.mm +++ b/src/SFML/Window/OSX/InputImpl.mm @@ -61,6 +61,7 @@ SFOpenGLView* GetSFOpenGLViewFromSFMLWindow(const Window& window) // Get our SFOpenGLView from ... SFOpenGLView* view = nil; + if ([nsHandle isKindOfClass:[NSWindow class]]) { // If system handle is a window then from its content view. view = [nsHandle contentView]; @@ -89,10 +90,13 @@ SFOpenGLView* GetSFOpenGLViewFromSFMLWindow(const Window& window) } } else { - - sf::Err() << "The system handle is neither a nor " - << "object. This shouldn't happen." - << std::endl; + if (nsHandle != 0) { + sf::Err() << "The system handle is neither a nor " + << "object. This shouldn't happen." + << std::endl; + } else { + // This probably means the SFML window was previously closed. + } }