]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't crash in wxOSX::wxClipboard::Clear() if initialization failed.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Aug 2010 22:15:27 +0000 (22:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Aug 2010 22:15:27 +0000 (22:15 +0000)
Creating the clipboard may fail (e.g. when running from a ssh session to an OS
X machine), don't crash by passing NULL pointer to PasteboardClear() if this
happens but assert and return instead.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/clipbrd.cpp

index fd8e9a6d45fb7b148e7ffec593a40001e62cce53..293173c9ec9c387359b1ec670a8c1b61715a598c 100644 (file)
@@ -63,6 +63,8 @@ void wxClipboard::Clear()
 {
     wxDELETE(m_data);
 
+    wxCHECK_RET( m_pasteboard, "Clipboard creation failed." );
+
     OSStatus err = PasteboardClear( m_pasteboard );
     if (err != noErr)
     {