diff options
author | Neil Hodgson <nyamatongwe@gmail.com> | 2014-03-26 11:25:19 +1100 |
---|---|---|
committer | Neil Hodgson <nyamatongwe@gmail.com> | 2014-03-26 11:25:19 +1100 |
commit | b64c296768de37dd2ed30a34ec7888e35fc13532 (patch) | |
tree | d2f717667eb3c438518cb992d731d9ef7156a3e6 | |
parent | ed404335a35853d9250c703a3f28acde63b9b20d (diff) | |
download | scintilla-mirror-b64c296768de37dd2ed30a34ec7888e35fc13532.tar.gz |
Do not call AddCharUTF for empty insertions as may crash when autocompletion active
or cause other unexpected behaviour.
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 1e9d6e973..f9e67f7b4 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1925,12 +1925,15 @@ int ScintillaCocoa::InsertText(NSString* input) CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?', false, NULL, 0, &usedLen); - std::vector<UInt8> buffer(usedLen); + if (usedLen > 0) + { + std::vector<UInt8> buffer(usedLen); - CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?', - false, buffer.data(),usedLen, NULL); + CFStringGetBytes((CFStringRef)input, rangeAll, encoding, '?', + false, buffer.data(),usedLen, NULL); - AddCharUTF((char*) buffer.data(), static_cast<unsigned int>(usedLen), false); + AddCharUTF((char*) buffer.data(), static_cast<unsigned int>(usedLen), false); + } return static_cast<int>(usedLen); } |