From 61fda4a401735a33cb46d23a89500c659305688e Mon Sep 17 00:00:00 2001 From: Diego Hernan Borghetti Date: Tue, 25 Mar 2008 12:20:53 -0300 Subject: [PATCH] Added null check to prevent crashing on paste. Should look into why XGetWindowProperty isnt working also. Author: Campbell Barton SVN revision: 14164 Date: 2008-03-18 13:12:43 -0300 (Tue, 18 Mar 2008) --- intern/ghost/intern/GHOST_SystemX11.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index d80b29e..82704be 100755 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -990,10 +990,12 @@ getClipboard(int flag XNextEvent(m_display, &xevent); if(xevent.type == SelectionNotify) { if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) { - tmp_data = (unsigned char*) malloc(strlen((char*)data)); - strcpy((char*)tmp_data, (char*)data); - XFree(data); - return (GHOST_TUns8*)tmp_data; + if (data) { + tmp_data = (unsigned char*) malloc(strlen((char*)data)); + strcpy((char*)tmp_data, (char*)data); + XFree(data); + return (GHOST_TUns8*)tmp_data; + } } return NULL; } -- 2.11.4.GIT