mirror of
https://github.com/minetest/irrlicht.git
synced 2025-01-11 18:40:18 +01:00
Add some error checking in COSOperator::copyToClipboard
GlobalAlloc and GlobalLock can return NULL git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6292 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
9e27a6d4bf
commit
cfb27d9a74
@ -71,12 +71,16 @@ void COSOperator::copyToClipboard(const c8* text) const
|
|||||||
char * buffer;
|
char * buffer;
|
||||||
|
|
||||||
clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text)+1);
|
clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text)+1);
|
||||||
buffer = (char*)GlobalLock(clipbuffer);
|
if ( clipbuffer )
|
||||||
|
{
|
||||||
strcpy(buffer, text);
|
buffer = (char*)GlobalLock(clipbuffer);
|
||||||
|
if ( buffer )
|
||||||
GlobalUnlock(clipbuffer);
|
{
|
||||||
SetClipboardData(CF_TEXT, clipbuffer);
|
strcpy(buffer, text);
|
||||||
|
}
|
||||||
|
GlobalUnlock(clipbuffer);
|
||||||
|
SetClipboardData(CF_TEXT, clipbuffer);
|
||||||
|
}
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||||
|
Loading…
Reference in New Issue
Block a user