Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Fix NPEs
Browse files Browse the repository at this point in the history
  • Loading branch information
kmod-midori committed Jan 25, 2017
1 parent f2f1a45 commit 84501c3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/src/main/kotlin/moe/reimu/weiboxposed/Module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,16 @@ class Module : IXposedHookInitPackageResources, IXposedHookLoadPackage, IXposedH
private fun shouldRemove(mblog: Any): Boolean {
if (isPromotion(mblog)) return true

val text = getObjectField(mblog, "text") as String
if (checkText(text, content_keyword)) return true
val text = getObjectField(mblog, "text") as? String
if (text != null) {
if (checkText(text, content_keyword)) return true
}

val user = getObjectField(mblog, "user")
val name = getObjectField(user, "screen_name") as String
if (checkText(name, user_keyword)) return true
if (user != null) {
val name = getObjectField(user, "screen_name") as String
if (checkText(name, user_keyword)) return true
}

val retweeted = getObjectField(mblog, "retweeted_status")
if (retweeted != null) {
Expand Down

0 comments on commit 84501c3

Please sign in to comment.