diff options
-rw-r--r-- | gtk/ScintillaGTK.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index d75072d27..30bc88d97 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1443,9 +1443,11 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se // Convert text to utf8 if it isn't already if (text->characterSet != SC_CP_UTF8) { const char *charSet = ::CharacterSetID(text->characterSet); - size_t new_len; - char* tmputf = ConvertText(&new_len, text->s, text->len, "UTF-8", charSet); - text->Set(tmputf, new_len, SC_CP_UTF8, text->rectangular); + if (*charSet) { + size_t new_len; + char* tmputf = ConvertText(&new_len, text->s, text->len, "UTF-8", charSet); + text->Set(tmputf, new_len, SC_CP_UTF8, text->rectangular); + } } // Here is a somewhat evil kludge. |