diff options
| author | nyamatongwe <unknown> | 2009-07-25 01:39:29 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2009-07-25 01:39:29 +0000 | 
| commit | 50bbf6003e0c45600ef53a85f1a1eaa596e37069 (patch) | |
| tree | 592da8470e18f6475cb00bc18d908bf56cb456b5 | |
| parent | a0c16905bdf90d20f5d715458163bcdf33b1a7eb (diff) | |
| download | scintilla-mirror-50bbf6003e0c45600ef53a85f1a1eaa596e37069.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;  | 
