diff options
author | nyamatongwe <devnull@localhost> | 2009-07-25 01:39:29 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2009-07-25 01:39:29 +0000 |
commit | 55926c01ce7c2df4e4d593e0154ace6e9d51da23 (patch) | |
tree | 592da8470e18f6475cb00bc18d908bf56cb456b5 | |
parent | 6a75914def95ea39b700150060ceccbff6472c60 (diff) | |
download | scintilla-mirror-55926c01ce7c2df4e4d593e0154ace6e9d51da23.tar.gz |
Protection against NULL pointer when copying empty selection.
-rw-r--r-- | gtk/ScintillaGTK.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 0d990e805..a64130266 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1614,18 +1614,19 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se // All other tested aplications behave benignly by ignoring the \0. // The #if is here because on Windows cfColumnSelect clip entry is used // instead as standard indicator of rectangularness (so no need to kludge) - int len = strlen(text->s); + const char *textData = text->s ? text->s : ""; + int len = strlen(textData); #if PLAT_GTK_WIN32 == 0 if (text->rectangular) len++; #endif if (info == TARGET_UTF8_STRING) { - gtk_selection_data_set_text(selection_data, text->s, len); + gtk_selection_data_set_text(selection_data, textData, len); } else { gtk_selection_data_set(selection_data, static_cast<GdkAtom>(GDK_SELECTION_TYPE_STRING), - 8, reinterpret_cast<unsigned char *>(text->s), len); + 8, reinterpret_cast<const unsigned char *>(textData), len); } delete converted; |