Skip to content

Commit b84e190

Browse files
committed
Fix text parameter for unknown event
This shouldn't occur, but if scintilla is updated in N++ before Python Script then it's possible. This will stop a crash in case text is NULL.
1 parent 8e65075 commit b84e190

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

PythonScript/src/ScintillaWrapper.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ void ScintillaWrapper::notify(SCNotification *notifyCode)
240240
params["hwndFrom"] = notifyCode->nmhdr.hwndFrom;
241241
params["position"] = notifyCode->position;
242242
params["modificationType"] = notifyCode->modificationType;
243-
params["text"] = notifyCode->text;
243+
if (notifyCode->text)
244+
{
245+
// notifyCode->text is not null terminated
246+
std::string text(notifyCode->text, notifyCode->length);
247+
params["text"] = text.c_str();
248+
}
244249
params["length"] = notifyCode->length;
245250
params["linesAdded"] = notifyCode->linesAdded;
246251
params["line"] = notifyCode->line;

0 commit comments

Comments
 (0)