[gmime] Fixed g_mime_header_iter_last() logic
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Fixed g_mime_header_iter_last() logic
- Date: Tue, 27 Nov 2012 02:05:56 +0000 (UTC)
commit aef2af68f15b14967f42ab8363e7a49a5e742fba
Author: Jeffrey Stedfast <fejj gnome org>
Date: Mon Nov 26 21:05:12 2012 -0500
Fixed g_mime_header_iter_last() logic
2012-11-26 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-header.c (g_mime_header_iter_first): Make sure the
list isn't empty.
(g_mime_header_iter_last): Same.
ChangeLog | 8 +++++++-
gmime/gmime-header.c | 8 ++------
2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7715048..3425c12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2012-11-23 Jeffrey Stedfast <jeff xamarin com>
+2012-11-26 Jeffrey Stedfast <fejj gnome org>
+
+ * gmime/gmime-header.c (g_mime_header_iter_first): Make sure the
+ list isn't empty.
+ (g_mime_header_iter_last): Same.
+
+2012-11-23 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-header.c (g_mime_header_list_prepend): Prepend the
header to the list, don't *append* it. Oops.
diff --git a/gmime/gmime-header.c b/gmime/gmime-header.c
index 96c2f51..030c154 100644
--- a/gmime/gmime-header.c
+++ b/gmime/gmime-header.c
@@ -264,12 +264,10 @@ g_mime_header_iter_first (GMimeHeaderIter *iter)
g_return_val_if_fail (iter != NULL, FALSE);
/* make sure we can actually do as requested */
- if (!iter->hdrlist)
+ if (!iter->hdrlist || list_is_empty (&iter->hdrlist->list))
return FALSE;
first = (GMimeHeader *) iter->hdrlist->list.head;
- if (!first->next)
- return FALSE;
iter->version = iter->hdrlist->version;
iter->cursor = first;
@@ -294,12 +292,10 @@ g_mime_header_iter_last (GMimeHeaderIter *iter)
g_return_val_if_fail (iter != NULL, FALSE);
/* make sure we can actually do as requested */
- if (!iter->hdrlist)
+ if (!iter->hdrlist || list_is_empty (&iter->hdrlist->list))
return FALSE;
last = (GMimeHeader *) iter->hdrlist->list.tailpred;
- if (!last->next)
- return FALSE;
iter->version = iter->hdrlist->version;
iter->cursor = last;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]