Skip to content

Commit

Permalink
avoid possible other null
Browse files Browse the repository at this point in the history
  • Loading branch information
larkery committed Jul 13, 2022
1 parent 819c851 commit 5960635
Showing 1 changed file with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,25 @@ public void setRRule(final String rrule) {
);

public void setEndTimeFromDuration(String string) {
Matcher g = durationPattern.matcher(string);
String W = g.group(1);
String D = g.group(2);
String T = g.group(3);
String M = g.group(4);

int w = W == null ? 0 : Integer.parseInt(W);
int d = D == null ? 0 : Integer.parseInt(D);
int t = T == null ? 0 : Integer.parseInt(T);
int m = M == null ? 0 : Integer.parseInt(M);

long millis = m * ONE_MINUTE +
long millis = 0;

if (string != null) {
Matcher g = durationPattern.matcher(string);
String W = g.group(1);
String D = g.group(2);
String T = g.group(3);
String M = g.group(4);

int w = W == null ? 0 : Integer.parseInt(W);
int d = D == null ? 0 : Integer.parseInt(D);
int t = T == null ? 0 : Integer.parseInt(T);
int m = M == null ? 0 : Integer.parseInt(M);

millis = m * ONE_MINUTE +
t * ONE_HOUR +
d * ONE_DAY +
w * ONE_WEEK;

}
setEndTime(startTime + millis);
}

Expand Down

0 comments on commit 5960635

Please sign in to comment.