Skip to content

Commit de6a59e

Browse files
committed
IOS-6907 T4624488 Fix crash when tapping shared items with no shares
(cherry picked from commit 86fd381)
1 parent 2b9a00b commit de6a59e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

iMEGA/Node/Shared Items/SharedItemsViewController+Additions.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,12 @@ extension SharedItemsViewController {
169169

170170
var isEnabled = false
171171
if incomingButton?.isSelected == true {
172-
isEnabled = incomingShareList.size.intValue > 0 ||
173-
incomingUnverifiedShareList.size.intValue > 0
172+
let inShareSize = incomingShareList?.size.intValue ?? 0
173+
let unverifiedInShareSize = incomingUnverifiedShareList?.size.intValue ?? 0
174+
isEnabled = inShareSize > 0 || unverifiedInShareSize > 0
174175
} else if outgoingButton?.isSelected == true {
175-
isEnabled = outgoingShareList.size.intValue > 0
176+
let outShareSize = outgoingShareList?.size.intValue ?? 0
177+
isEnabled = outShareSize > 0
176178
} else if linksButton?.isSelected == true {
177179
isEnabled = publicLinksArray.isNotEmpty
178180
}

iMEGA/Node/Shared Items/SharedItemsViewController.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ NS_ASSUME_NONNULL_BEGIN
2929
@property (weak, nonatomic) IBOutlet UIView *outgoingLineView;
3030
@property (weak, nonatomic) IBOutlet UIView *linksLineView;
3131

32-
@property (nonatomic, strong) MEGAShareList *outgoingShareList;
32+
@property (nonatomic, strong, nullable) MEGAShareList *outgoingShareList;
3333
@property (nonatomic, strong, nullable) MEGAShareList *outgoingUnverifiedShareList;
3434
@property (nonatomic, strong, nullable) NSMutableArray<MEGAShare *> *outgoingUnverifiedSharesMutableArray;
3535
@property (nonatomic, strong, nullable) NSMutableArray<MEGANode *> *outgoingUnverifiedNodesMutableArray;
3636

37-
@property (nonatomic, strong) MEGAShareList *incomingShareList;
38-
@property (nonatomic, strong) MEGAShareList *incomingUnverifiedShareList;
37+
@property (nonatomic, strong, nullable) MEGAShareList *incomingShareList;
38+
@property (nonatomic, strong, nullable) MEGAShareList *incomingUnverifiedShareList;
3939
@property (nonatomic, strong, nullable) NSMutableArray<MEGAShare *> *incomingUnverifiedSharesMutableArray;
4040
@property (nonatomic, strong, nullable) NSMutableArray<MEGANode *> *incomingUnverifiedNodesMutableArray;
4141

0 commit comments

Comments
 (0)