Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit 601aeb3

Browse files
committed
Modify logic of -assignToChannel:
Fixes condition in which `channel` variable has a value but its member list is nil which causes parted channels to present member list of previous selection.
1 parent 45bca19 commit 601aeb3

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

Sources/App/Classes/IRC/IRCChannelMemberListController.m

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,22 @@ - (void)assignToChannel:(nullable IRCChannel *)channel
6565

6666
if ( oldList) {
6767
[oldList assignController:nil];
68-
69-
self.memberList = nil;
70-
71-
/* If we were already assigned to a list, but will now be
72-
assigned to nothing, then clear contents and do nothing more. */
73-
if (channel == nil) {
74-
self.content = @[];
75-
76-
return;
77-
}
7868
}
7969

80-
/* Assign to channel */
8170
IRCChannelMemberList *newList = channel.memberInfo;
8271

83-
[newList assignController:self];
72+
if ( newList) {
73+
[newList assignController:self];
74+
}
8475

76+
/* It is acceptable and correct behavior to assign nil
77+
to -memberList when there is none so there is no reason
78+
to place this assignment in the condition above. */
8579
self.memberList = newList;
80+
81+
if (channel == nil || newList == nil) {
82+
self.content = @[];
83+
}
8684
}
8785

8886
- (void)replaceContents:(NSArray<IRCChannelUser *> *)contents

0 commit comments

Comments
 (0)