From 81c19976e3fc83c0195d49f2946025b2bf8ac997 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 7 Jan 2022 14:44:58 -0500 Subject: [PATCH] fix(mail): handle case where the msg is of content type application --- UI/MailPartViewers/UIxMailPartViewer.m | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/UI/MailPartViewers/UIxMailPartViewer.m b/UI/MailPartViewers/UIxMailPartViewer.m index 7b1d72040..1e0e7a433 100644 --- a/UI/MailPartViewers/UIxMailPartViewer.m +++ b/UI/MailPartViewers/UIxMailPartViewer.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2017 Inverse inc. + Copyright (C) 2007-2022 Inverse inc. Copyright (C) 2004-2005 SKYRIX Software AG This file is part of SOGo. @@ -21,6 +21,7 @@ */ #import +#import #import #import @@ -168,11 +169,20 @@ NSEnumerator *parts; currentObject = [self clientObject]; - parts = [partPath objectEnumerator]; - while ((currentPart = [parts nextObject])) - currentObject = [currentObject lookupName: currentPart - inContext: context - acquire: NO]; + if (partPath) + { + parts = [partPath objectEnumerator]; + while ((currentPart = [parts nextObject])) + currentObject = [currentObject lookupName: currentPart + inContext: context + acquire: NO]; + } + else + { + [self warnWithFormat: @"No path specified, returning first part"]; + currentObject = [[self clientObject] lookupImap4BodyPartKey: @"0" + inContext: context]; + } return currentObject; }