mirror of
https://github.com/minetest/irrlicht.git
synced 2025-01-11 10:30: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;
|
||||
|
||||
clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text)+1);
|
||||
buffer = (char*)GlobalLock(clipbuffer);
|
||||
|
||||
strcpy(buffer, text);
|
||||
|
||||
GlobalUnlock(clipbuffer);
|
||||
SetClipboardData(CF_TEXT, clipbuffer);
|
||||
if ( clipbuffer )
|
||||
{
|
||||
buffer = (char*)GlobalLock(clipbuffer);
|
||||
if ( buffer )
|
||||
{
|
||||
strcpy(buffer, text);
|
||||
}
|
||||
GlobalUnlock(clipbuffer);
|
||||
SetClipboardData(CF_TEXT, clipbuffer);
|
||||
}
|
||||
CloseClipboard();
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
|
Loading…
Reference in New Issue
Block a user