Fix crash if document closed while custom command is executing

Custom command callback never checked that the doc was still valid.
Can still paste in the wrong doc if user closes and opens while
the command is running, but not crash.
This commit is contained in:
elextr 2014-02-10 12:19:45 +11:00
parent 09c2315bc4
commit 5d3b2f6269

View File

@ -290,7 +290,7 @@ static gboolean cc_replace_sel_cb(gpointer user_data)
return TRUE;
}
if (! data->error && data->buffer != NULL)
if (! data->error && data->buffer != NULL && DOC_VALID(data->doc))
{ /* Command completed successfully */
sci_replace_sel(data->doc->editor->sci, data->buffer->str);
}