[gnumeric] Clipboard: guard against unexpected NULL from gtk+.



commit fd1659dd9fd944fe4a28980b144407351d4cbbb0
Author: Morten Welinder <terra gnome org>
Date:   Sun Nov 9 21:38:01 2014 -0500

    Clipboard: guard against unexpected NULL from gtk+.

 ChangeLog           |    5 +++++
 NEWS                |    1 +
 src/gui-clipboard.c |   11 +++++++++++
 3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2d79910..e177699 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-09  Morten Welinder  <terra gnome org>
+
+       * src/gui-clipboard.c (text_to_cell_region): Guard against NULL
+       data.  Might fix Redhat #1160975.
+
 2014-10-28  Morten Welinder  <terra gnome org>
 
        * src/style.c (find_font): Accept NULL font name.
diff --git a/NEWS b/NEWS
index 3612af2..2a0e4cc 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Jean:
 Morten:
        * Plug leaks.
        * Pay more attention to union access rules.
+       * Attempt a fix for clipboard crash.  [Redhat #1160975]
 
 Thomas Kluyver:
        * Fix import of extended floats from wk4 files.  [#739697]
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index 50befa5..e978cb8 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -131,6 +131,17 @@ text_to_cell_region (WBCGtk *wbcg,
        gboolean oneline;
        char *data_converted = NULL;
 
+       if (!data) {
+               /*
+                * See Redhat #1160975.
+                * 
+                * I'm unsure why someone get NULL here, but this is better
+                * than a crash.
+                */
+               data = "";
+               data_len = 0;
+       }
+
        oneline = text_is_single_cell (data, data_len);
 
        if (oneline && (opt_encoding == NULL || strcmp (opt_encoding, "UTF-8") != 0)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]