Skip to content

Commit

Permalink
:bug Fix crash when left expression is null for some reason
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavst committed Feb 11, 2022
1 parent c22d582 commit 2aedead
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Set of JEB plugins and scripts for better Android reversing experience.
### Offline environment

Extract the provided `offline.tar.xz` to the main project's folder. You are good to go.
Run with --offline

### Compilation

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ apply plugin: 'kotlin'


group 'org.yoavst.jeb'
version '0.4.0'
version '0.4.1'

compileKotlin {
kotlinOptions {
Expand Down
11 changes: 11 additions & 0 deletions src/main/kotlin/com/yoavst/jeb/bridge/UIBridge.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.yoavst.jeb.bridge

import com.pnfsoftware.jeb.client.api.IGraphicalClientContext
import com.pnfsoftware.jeb.core.output.IItem
import com.pnfsoftware.jeb.core.units.code.android.dex.IDexItem
import com.pnfsoftware.jeb.core.units.code.android.dex.IDexMethod
import com.pnfsoftware.jeb.core.units.code.android.dex.IDexType
import com.yoavst.jeb.utils.currentFocusedMethod
Expand All @@ -13,16 +15,23 @@ object UIBridge {
private set
var focusedClass: IDexType? = null
private set
var focusedAddr: String? = null
private set
var focusedItem: IItem? = null
private set

var currentMethod: IDexMethod? = null
private set

var currentClass: IDexType? = null
private set

@JvmStatic
fun update(context: IGraphicalClientContext) {
focusedMethod = context.currentFocusedMethod()
focusedClass = context.currentFocusedType()
focusedAddr = context.focusedFragment?.activeAddress
focusedItem = context.focusedFragment?.activeItem
currentMethod = context.currentFocusedMethod(supportFocus = false, verbose = false)
currentClass = context.currentFocusedType(supportFocus = false, verbose = false)
}
Expand All @@ -32,5 +41,7 @@ object UIBridge {
CurrentMethod: $currentMethod
FocusedClass: $focusedClass
CurrentClass: $currentClass
FocusedItem: $focusedItem
FocusedAddr: $focusedAddr
""".trimIndent()
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ToStringRenamingPlugin : BasicEnginesPlugin(supportsClassFilter = true, de

/** Process a toString() method from the given class **/
private fun processToStringMethod(method: IJavaMethod, cls: IDexClass, renameEngine: RenameEngine) {
// currently supports only one style of toString
// currently, supports only one style of toString
if (method.body.size() == 0 || method.body[0] !is IJavaReturn)
return

Expand Down Expand Up @@ -128,7 +128,7 @@ class ToStringRenamingPlugin : BasicEnginesPlugin(supportsClassFilter = true, de

}
else -> {
logger.debug("Warning: The toString method for ${cls.name} has a complex expression ${left.javaClass.canonicalName}")
logger.debug("Warning: The toString method for ${cls.name} has a complex expression ${left?.javaClass?.canonicalName}")
return
}
}
Expand Down

0 comments on commit 2aedead

Please sign in to comment.