Skip to content

Commit 99e69cb

Browse files
Merge pull request #247 from MariusCiocanel/fix-nil-string-on-NSTextField-crash
set email and personal message only if they are not nil
2 parents 16472fe + 91d5eef commit 99e69cb

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

AppBox/ViewController/HomeViewController/HomeViewController.m

+14-7
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ -(void)setupUploadManager{
124124
- (void)initCIProcess:(NSNotification *)notification {
125125
if ([notification.object isKindOfClass:[XCProject class]]) {
126126
self.ciRepoProject = notification.object;
127-
if (self.ciRepoProject.ipaFullPath) {
128-
[self initIPAUploadProcessForURL:self.ciRepoProject.ipaFullPath];
129-
}
127+
[self initIPAUploadProcessForCIProject:self.ciRepoProject];
130128
}
131129
}
132130

@@ -165,13 +163,22 @@ - (IBAction)selectedFilePathHandler:(NSPathControl *)sender {
165163
}
166164
}
167165

168-
- (void)initIPAUploadProcessForURL:(NSURL *)ipaURL {
166+
- (void)initIPAUploadProcessForCIProject:(XCProject *)ciProject {
167+
NSURL *ipaURL = ciProject.ipaFullPath;
168+
if (ipaURL == nil) {
169+
return;
170+
}
171+
169172
[self viewStateForProgressFinish:YES];
170173
[self.project setIpaFullPath:ipaURL];
171174
[selectedFilePath setURL:ipaURL];
172-
[textFieldEmail setStringValue:self.project.emails];
173-
[textFieldMessage setStringValue:self.project.personalMessage];
174-
[buttonUniqueLink setState:self.project.keepSameLink.boolValue ? NSOnState : NSOffState];
175+
if (ciProject.emails.length != 0) {
176+
[textFieldEmail setStringValue:ciProject.emails];
177+
}
178+
if (ciProject.personalMessage.length != 0) {
179+
[textFieldMessage setStringValue:ciProject.personalMessage];
180+
}
181+
[buttonUniqueLink setState:ciProject.keepSameLink.boolValue ? NSOnState : NSOffState];
175182
[self actionButtonTapped:buttonAction];
176183
}
177184

0 commit comments

Comments
 (0)