diff --git a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
index 08db791..49b87df 100644
--- a/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
+++ b/src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
@@ -246,6 +246,8 @@ internal object PatchCommand : Runnable {
                 .resolve("${outputFilePath.nameWithoutExtension}.keystore")
 
         val installer = if (deviceSerial != null) {
+            val deviceSerial = deviceSerial!!.ifEmpty { null }
+
             try {
                 if (mount) {
                     AdbRootInstaller(deviceSerial)