fix buggy isApng()
This commit is contained in:
parent
d554f4d828
commit
3896d45b19
|
@ -17,9 +17,10 @@ class Utils {
|
|||
* Know if file is an APNG
|
||||
* @return True if is an APNG
|
||||
*/
|
||||
fun isApng(byteArray: ByteArray): Boolean {
|
||||
fun isApng(byteArray: ByteArray) : Boolean {
|
||||
try {
|
||||
val acTL = byteArrayOf(0x66, 0x63, 0x54, 0x4c)
|
||||
loop@for (i in 0 until byteArray.size) {
|
||||
loop@ for (i in 0 until byteArray.size) {
|
||||
val it = byteArray.copyOfRange(i, i + 4)
|
||||
// if byteArray contain acTL
|
||||
if (it.contentEquals(acTL)) {
|
||||
|
@ -27,6 +28,9 @@ class Utils {
|
|||
}
|
||||
}
|
||||
return false
|
||||
} catch (e : Exception) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue