[evolution-data-server] data_book_error_from_gdata_error: Make sure we actually set an error.



commit 3c101d5dc7770af668ca92f46bffb8142d018afb
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jun 17 10:46:08 2013 -0400

    data_book_error_from_gdata_error: Make sure we actually set an error.
    
    Had an instance where the error code didn't match one of the predefined
    cases.  The GError never got set, and we crashed trying to deference it.

 .../backends/google/e-book-backend-google.c        |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c 
b/addressbook/backends/google/e-book-backend-google.c
index 3145839..b064b67 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -82,6 +82,8 @@ static void
 data_book_error_from_gdata_error (GError **error,
                                   const GError *gdata_error)
 {
+       gboolean use_fallback = FALSE;
+
        g_return_if_fail (gdata_error != NULL);
 
        /* Authentication errors */
@@ -113,6 +115,7 @@ data_book_error_from_gdata_error (GError **error,
                                E_CLIENT_ERROR_REPOSITORY_OFFLINE));
                        break;
                default:
+                       use_fallback = TRUE;
                        break;
                }
 
@@ -174,17 +177,22 @@ data_book_error_from_gdata_error (GError **error,
                                gdata_error->message);
                        break;
                default:
+                       use_fallback = TRUE;
                        break;
                }
 
-       /* Generic fallback */
        } else {
+               use_fallback = TRUE;
+       }
+
+       /* Generic fallback */
+       if (use_fallback)
                g_set_error_literal (
                        error, E_CLIENT_ERROR,
                        E_CLIENT_ERROR_OTHER_ERROR,
                        gdata_error->message);
-       }
 }
+
 static void
 migrate_cache (EBookBackendCache *cache)
 {


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