[evolution-data-server] google: Add a missing NULL pointer check



commit befc38214eb6d42fbf5736b659159534aa081924
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Aug 16 23:25:12 2011 +0100

    google: Add a missing NULL pointer check
    
    This fixes a crash when editing contacts without avatars (and not adding an
    avatar).

 .../backends/google/e-book-backend-google.c        |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google.c b/addressbook/backends/google/e-book-backend-google.c
index 6689a2c..ac4a05a 100644
--- a/addressbook/backends/google/e-book-backend-google.c
+++ b/addressbook/backends/google/e-book-backend-google.c
@@ -1641,8 +1641,9 @@ e_book_backend_google_modify_contact (EBookBackend *backend, EDataBook *book, gu
 	} else if (old_photo != NULL && (new_photo == NULL || new_photo->type != E_CONTACT_PHOTO_TYPE_INLINED)) {
 		/* Removing a photo */
 		data->photo_operation = REMOVE_PHOTO;
-	} else if (old_photo->data.inlined.length != new_photo->data.inlined.length ||
-		   memcmp (old_photo->data.inlined.data, new_photo->data.inlined.data, old_photo->data.inlined.length) != 0) {
+	} else if (old_photo != NULL && new_photo != NULL &&
+		   (old_photo->data.inlined.length != new_photo->data.inlined.length ||
+		    memcmp (old_photo->data.inlined.data, new_photo->data.inlined.data, old_photo->data.inlined.length) != 0)) {
 		/* Modifying the photo */
 		data->photo_operation = UPDATE_PHOTO;
 	} else {



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