Skip to content

Commit 07e7f0c

Browse files
committed
fix: subscription
1 parent ec489ab commit 07e7f0c

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

service/src/main/java/com/github/kr328/clash/service/ProfileManager.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ class ProfileManager(private val context: Context) : IProfileManager,
159159
for (flag in flags) {
160160
val info = flag.split("=")
161161
when {
162-
info[0].contains("upload") -> upload =
162+
info[0].contains("upload") && info[1].isNotEmpty() -> upload =
163163
BigDecimal(info[1]).longValueExact()
164164

165-
info[0].contains("download") -> download =
165+
info[0].contains("download") && info[1].isNotEmpty() -> download =
166166
BigDecimal(info[1]).longValueExact()
167167

168-
info[0].contains("total") -> total =
168+
info[0].contains("total") && info[1].isNotEmpty() -> total =
169169
BigDecimal(info[1]).longValueExact()
170170

171-
info[0].contains("expire") -> {
171+
info[0].contains("expire") && info[1].isNotEmpty() -> {
172172
if (info[1].isNotEmpty()) {
173173
expire = (info[1].toDouble()*1000).toLong()
174174
}

service/src/main/java/com/github/kr328/clash/service/ProfileProcessor.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,17 @@ object ProfileProcessor {
8787
for (flag in flags) {
8888
val info = flag.split("=")
8989
when {
90-
info[0].contains("upload") -> upload =
90+
info[0].contains("upload") && info[1].isNotEmpty() -> upload =
9191
info[1].toLong()
9292

93-
info[0].contains("download") -> download =
93+
info[0].contains("download") && info[1].isNotEmpty() -> download =
9494
info[1].toLong()
9595

96-
info[0].contains("total") -> total =
96+
info[0].contains("total") && info[1].isNotEmpty() -> total =
9797
info[1].toLong()
9898

99-
info[0].contains("expire") -> {
100-
if (info[1].isNotEmpty()) {
101-
expire =
102-
(info[1].toDouble() * 1000).toLong()
103-
}
104-
}
99+
info[0].contains("expire") && info[1].isNotEmpty() -> expire =
100+
(info[1].toDouble() * 1000).toLong()
105101
}
106102
}
107103
}

0 commit comments

Comments
 (0)