diff options
author | pidgezero_one <s.kischak@gmail.com> | 2021-10-04 16:24:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 22:24:45 +0200 |
commit | 744729741f736cb253a8ea95680c1560deb669ce (patch) | |
tree | ce6541cd44cfe70cf364f14248ba0434bcb7ce40 /src/com/dabomstew | |
parent | 6c9522319c81d6abdbf8316384dfd7c1d9c27298 (diff) |
Prevent TM/HM compatibility log crash caused by blank attack names (#304)
* Prevents the application from crashing when generating a TM/HM compatibility log where move names are blank by writing a placeholder to the log file instead of the move name literal. This AFAIK only affects the "Vietnamese Crystal" bootleg.
Co-authored-by: pidgezero <pidgezero.one@gmail.com>
Diffstat (limited to 'src/com/dabomstew')
-rw-r--r-- | src/com/dabomstew/pkrandom/Randomizer.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/dabomstew/pkrandom/Randomizer.java b/src/com/dabomstew/pkrandom/Randomizer.java index c48d3ee..c955c67 100644 --- a/src/com/dabomstew/pkrandom/Randomizer.java +++ b/src/com/dabomstew/pkrandom/Randomizer.java @@ -979,17 +979,20 @@ public class Randomizer { log.printf("%3d " + nameSpFormat, pkmn.number, pkmn.fullName() + " ");
for (int i = 1; i < flags.length; i++) {
-
- int moveNameLength = moveData.get(moveList.get(i - 1)).name.length();
+ String moveName = moveData.get(moveList.get(i - 1)).name;
+ if (moveName.length() == 0) {
+ moveName = "(BLANK)";
+ }
+ int moveNameLength = moveName.length();
if (flags[i]) {
if (includeTMNumber) {
if (i <= tmCount) {
- log.printf("|TM%02d %" + moveNameLength + "s ", i, moveData.get(moveList.get(i - 1)).name);
+ log.printf("|TM%02d %" + moveNameLength + "s ", i, moveName);
} else {
- log.printf("|HM%02d %" + moveNameLength + "s ", i-tmCount, moveData.get(moveList.get(i - 1)).name);
+ log.printf("|HM%02d %" + moveNameLength + "s ", i-tmCount, moveName);
}
} else {
- log.printf("|%" + moveNameLength + "s ", moveData.get(moveList.get(i - 1)).name);
+ log.printf("|%" + moveNameLength + "s ", moveName);
}
} else {
if (includeTMNumber) {
|