Skip to content

Commit

Permalink
fix: app crashing on latest beta (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujin-cho authored Jan 20, 2024
1 parent 89e628c commit d24bbf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion app/src/main/java/dev/bluehouse/enablevolte/Moder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,21 @@ open class Moder {

class CarrierModer(private val context: Context) : Moder() {
val subscriptions: List<SubscriptionInfo>
get() = this.loadCachedInterface { sub }.getActiveSubscriptionInfoList(null, null)
get() {
val sub = this.loadCachedInterface { sub }
return try {
sub.getActiveSubscriptionInfoList(null, null)
} catch (e: NoSuchMethodError) {
// FIXME: lift up reflect as soon as official source code releases
val getActiveSubscriptionInfoListMethod = sub.javaClass.getMethod(
"getActiveSubscriptionInfoList",
String::class.java,
String::class.java,
Boolean::class.java,
)
(getActiveSubscriptionInfoListMethod.invoke(sub, null, null, false) as List<SubscriptionInfo>)
}
}

val defaultSubId: Int
get() {
Expand Down

0 comments on commit d24bbf0

Please sign in to comment.