Bug Fix Open Empty Files
This commit is contained in:
parent
7d252fd5bc
commit
4c2e72e78e
1 changed files with 3 additions and 0 deletions
|
@ -163,6 +163,9 @@ public class MiscUtils
|
||||||
|
|
||||||
public static String getFileHeaderMagicNumber(byte[] fileContents)
|
public static String getFileHeaderMagicNumber(byte[] fileContents)
|
||||||
{
|
{
|
||||||
|
if(fileContents == null || fileContents.length < 4)
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
|
||||||
return String.format("%02X%02X%02X%02X", fileContents[0],
|
return String.format("%02X%02X%02X%02X", fileContents[0],
|
||||||
fileContents[1], fileContents[2],fileContents[3]);
|
fileContents[1], fileContents[2],fileContents[3]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue