diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-03-18 19:12:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-03-18 19:12:43 +0300 |
commit | c8813776c491f2f503e8cb4ab7cc321e487330b5 (patch) | |
tree | 5141aba1570c32724b45431694bb254578bb4b59 /intern/ghost | |
parent | f47aec78c9dc7a74f61b43009a5e1bcc7f190596 (diff) |
Added null check to prevent crashing on paste.
Should look into why XGetWindowProperty isnt working also.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 10 |
1 files 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; } |