Skip to content

Commit 69ae42e

Browse files
committed
Avoid index exceptions in status command
1 parent f6d7949 commit 69ae42e

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

DriveBackup/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
<minimizeJar>false</minimizeJar>
4545
<createDependencyReducedPom>false</createDependencyReducedPom>
4646
<relocations>
47-
<relocation>
48-
<pattern>com.github.maxmaeder</pattern>
49-
<shadedPattern>ratismal.drivebackup.DriveBackup.lib</shadedPattern>
50-
</relocation>
5147
<relocation>
5248
<pattern>org.bstats</pattern>
5349
<shadedPattern>ratismal.drivebackup.DriveBackup.lib</shadedPattern>

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ private void makeBackupFile(String location, LocalDateTimeFormatter formatter, L
391391
private void uploadBackupFiles(List<Uploader> uploaders) {
392392
for (BackupListEntry set : backupList) {
393393
backupBackingUp++;
394-
for(Path folder : set.location.getPaths()) {
394+
for (Path folder : set.location.getPaths()) {
395395
uploadFile(folder.toString(), set.formatter, uploaders);
396396
}
397397
}
@@ -583,12 +583,12 @@ public static String getBackupStatus() {
583583
}
584584
BackupListEntry[] backupList = config.backupList.list;
585585
int backup = 0;
586-
//edge case when its in between backup steps where number is set to 0
587-
int backupNumber = Math.max(0, backupBackingUp-1);
588-
if (backupNumber <= backupList.length) {
589-
backup = backupNumber;
590-
}
591-
String backupSetName = backupList[backup].location.toString();
586+
587+
int backupNumber = Math.max(0, backupBackingUp - 1);
588+
int backupIndex = Math.min(backupNumber, backupList.length - 1);
589+
590+
String backupSetName = backupList[backupIndex].location.toString();
591+
592592
return message
593593
.replace("<set-name>", backupSetName)
594594
.replace("<set-num>", String.valueOf(backupNumber+1))

0 commit comments

Comments
 (0)