[PATCH 08/10] Avoid crash on getting reference to bs header, as it won't be a TnyCamelMsgHeader.



---
 libtinymail-camel/tny-camel-folder.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libtinymail-camel/tny-camel-folder.c b/libtinymail-camel/tny-camel-folder.c
index b689d70..d1b26ba 100644
--- a/libtinymail-camel/tny-camel-folder.c
+++ b/libtinymail-camel/tny-camel-folder.c
@@ -3172,7 +3172,9 @@ tny_camel_folder_find_msg_default (TnyFolder *self, const gchar *url_string, GEr
 			if (retval) {
 				nhdr = tny_msg_get_header (retval);
 				/* This trick is for forcing owning a TnyCamelHeader reference */
-				_tny_camel_msg_header_set_decorated ((TnyCamelMsgHeader *) nhdr, hdr, TRUE);
+				if (hdr != nhdr && TNY_IS_CAMEL_MSG_HEADER (nhdr)) {
+					_tny_camel_msg_header_set_decorated ((TnyCamelMsgHeader *) nhdr, hdr, TRUE);
+				}
 				g_object_unref (nhdr);
 			}
 			g_object_unref (hdr);
-- 
1.6.3.3


--=-gnkDh763C8UIUYIzLd8x
Content-Disposition: attachment; filename*0=0009-Set-bs-message-header-as-cached-after-retrieving-it-.pat; filename*1=ch
Content-Type: text/x-patch; name="0009-Set-bs-message-header-as-cached-after-retrieving-it-.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



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