diff options
author | Andrea Weikert <elubie@gmx.net> | 2006-07-13 21:13:31 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2006-07-13 21:13:31 +0400 |
commit | 11f70391d2d6e1bb7a1415c37fb121dbd7da1d2e (patch) | |
tree | 426ac3e17ae131a2bf0ded28ab612eb3484a6d46 /source/blender/src/drawtext.c | |
parent | 5ee3d1da10804c06fe83267a932d35697e6b0741 (diff) |
- fix for [ #4678 ] ALL Blender versions crashes when pasting empty windows clipboard!
quickly sneaked in last minute before release ;)
Diffstat (limited to 'source/blender/src/drawtext.c')
-rw-r--r-- | source/blender/src/drawtext.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/src/drawtext.c b/source/blender/src/drawtext.c index 4cce31ff7a3..5025b08de1e 100644 --- a/source/blender/src/drawtext.c +++ b/source/blender/src/drawtext.c @@ -1288,8 +1288,10 @@ void txt_paste_clipboard(Text *text) { if ( OpenClipboard(NULL) ) { HANDLE hData = GetClipboardData( CF_TEXT ); buffer = (char*)GlobalLock( hData ); - buffer = unixNewLine(buffer); - txt_insert_buf(text, buffer); + if (buffer) { + buffer = unixNewLine(buffer); + if (buffer) txt_insert_buf(text, buffer); + } GlobalUnlock( hData ); CloseClipboard(); MEM_freeN(buffer); @@ -1304,17 +1306,19 @@ void txt_copy_clipboard(Text *text) { if (OpenClipboard(NULL)) { HLOCAL clipbuffer; char* buffer; + + if (copybuffer) { + copybuffer = winNewLine(copybuffer); - copybuffer = winNewLine(copybuffer); - - EmptyClipboard(); - clipbuffer = LocalAlloc(LMEM_FIXED,((bufferlength+1))); - buffer = (char *) LocalLock(clipbuffer); + EmptyClipboard(); + clipbuffer = LocalAlloc(LMEM_FIXED,((bufferlength+1))); + buffer = (char *) LocalLock(clipbuffer); - strncpy(buffer, copybuffer, bufferlength); - buffer[bufferlength] = '\0'; - LocalUnlock(clipbuffer); - SetClipboardData(CF_TEXT,clipbuffer); + strncpy(buffer, copybuffer, bufferlength); + buffer[bufferlength] = '\0'; + LocalUnlock(clipbuffer); + SetClipboardData(CF_TEXT,clipbuffer); + } CloseClipboard(); } |