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 | 3d309c07bf8d250309831f6db047d63bc4dd744d (patch) | |
tree | ee705e0dfbe74484af52e61967ab9efb79fbbf04 /cocoa | |
parent | c839f48dac5f79e8beed661bb8742a778b4bbaf3 (diff) | |
download | scintilla-mirror-3d309c07bf8d250309831f6db047d63bc4dd744d.tar.gz |
Do not call AddCharUTF for empty insertions as may crash when autocompletion active
or cause other unexpected behaviour.
Diffstat (limited to 'cocoa')
-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); } |