diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java index 8a5ea56b..3fb628c1 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java @@ -163,6 +163,9 @@ public class MiscUtils public static String getFileHeaderMagicNumber(byte[] fileContents) { + if(fileContents == null || fileContents.length < 4) + return StringUtils.EMPTY; + return String.format("%02X%02X%02X%02X", fileContents[0], fileContents[1], fileContents[2],fileContents[3]); }