From c8813776c491f2f503e8cb4ab7cc321e487330b5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 18 Mar 2008 16:12:43 +0000 Subject: [PATCH] Added null check to prevent crashing on paste. Should look into why XGetWindowProperty isnt working also. --- 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 55881b1f007..0329241045f 100644 --- 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; }