Bug 1460810 - [Gtk/Wayland] Handle error value (-1) returned by gtk_section_data_get_length(), r=stransky

This commit is contained in:
Evan Klitzke 2018-05-11 00:30:00 +03:00
parent de265e92c7
commit b2b1e7e2c3

View File

@ -667,8 +667,9 @@ nsRetrievalContextWayland::TransferFastTrackClipboard(
int aClipboardRequestNumber, GtkSelectionData *aSelectionData)
{
if (mClipboardRequestNumber == aClipboardRequestNumber) {
mClipboardDataLength = gtk_selection_data_get_length(aSelectionData);
if (mClipboardDataLength > 0) {
int dataLength = gtk_selection_data_get_length(aSelectionData);
if (dataLength > 0) {
mClipboardDataLength = dataLength;
mClipboardData = reinterpret_cast<char*>(
g_malloc(sizeof(char)*mClipboardDataLength));
memcpy(mClipboardData, gtk_selection_data_get_data(aSelectionData),