Skip to content

Commit 679ca86

Browse files
committed
Add negative check to getBackupStatus
1 parent 24f4977 commit 679ca86

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

DriveBackup/src/main/java/ratismal/drivebackup/UploadThread.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,16 @@ public static String getBackupStatus() {
570570
return intl("backup-status-not-running");
571571
}
572572
BackupListEntry[] backupList = config.backupList.list;
573-
String backupSetName = backupList[backupBackingUp].location.toString();
573+
int backup = 0;
574+
//edge case when its in between backup steps where number is set to 0
575+
int backupNumber = Math.max(0, backupBackingUp-1);
576+
if (backupNumber <= backupList.length) {
577+
backup = backupNumber;
578+
}
579+
String backupSetName = backupList[backup].location.toString();
574580
return message
575581
.replace("<set-name>", backupSetName)
576-
.replace("<set-num>", String.valueOf(backupBackingUp))
582+
.replace("<set-num>", String.valueOf(backupNumber+1))
577583
.replace("<set-count>", String.valueOf(backupList.length));
578584
}
579585

0 commit comments

Comments
 (0)