2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 13:47:41 +00:00

Add packet type information when an OOM happens

This commit is contained in:
Albert Vaca Cintora 2024-04-12 09:21:59 +02:00
parent 175ee9b011
commit 6d431c5797
No known key found for this signature in database

View File

@ -11,6 +11,7 @@ import org.json.JSONObject
import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import java.lang.RuntimeException
import java.net.Socket
import kotlin.concurrent.Volatile
@ -216,7 +217,11 @@ class NetworkPacket private constructor(
jo.put("payloadTransferInfo", payloadTransferInfo)
}
// QJSon does not escape slashes, but Java JSONObject does. Converting to QJson format.
return jo.toString().replace("\\/", "/") + "\n"
try {
return jo.toString().replace("\\/", "/") + "\n"
} catch (e : OutOfMemoryError) {
throw RuntimeException("OOM serializing packet of type $type", e)
}
}
val payloadSize: Long