fix buggy isApng()

This commit is contained in:
oupson 2018-11-15 21:17:14 +01:00
parent d554f4d828
commit 3896d45b19
1 changed files with 12 additions and 8 deletions

View File

@ -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
}
}
/**