Skip to content

Commit ee394c0

Browse files
authored
Npe fix in Instrumented Process (#1766)
[utbot-rider] Npe fix in for #1292 - #1292 (comment), but this is not fix
1 parent 2a446d6 commit ee394c0

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/instrumentation/execution/UtExecutionInstrumentation.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ object UtExecutionInstrumentation : Instrumentation<UtConcreteExecutionResult> {
9898
// invariants:
9999
// 1. phase must always complete if started as static reset relies on it
100100
// 2. phase must be fast as there are no incremental changes
101-
postprocessingPhase.savedStatics = preparationPhase.start {
101+
postprocessingPhase.setStaticFields(preparationPhase.start {
102102
val result = setStaticFields(statics)
103103
resetTrace()
104104
result
105-
}
105+
})
106106

107107
// invocation
108108
val concreteResult = executePhaseInTimeout(invocationPhase) {

utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/instrumentation/execution/phases/PostprocessingPhase.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ class PostprocessingPhase : ExecutionPhase {
1212

1313
private var savedStaticsInstance: Map<FieldId, Any?>? = null
1414

15-
var savedStatics: Map<FieldId, Any?>
16-
get() = savedStaticsInstance!!
17-
set(value) {
18-
savedStaticsInstance = value
19-
}
15+
fun setStaticFields(savedStatics: Map<FieldId, Any?>) {
16+
savedStaticsInstance = savedStatics
17+
}
2018

2119
override fun wrapError(e: Throwable): ExecutionPhaseException = ExecutionPhaseError(this.javaClass.simpleName, e)
2220

2321
fun resetStaticFields() {
24-
savedStatics.forEach { (fieldId, value) ->
22+
savedStaticsInstance?.forEach { (fieldId, value) ->
2523
fieldId.jField.run {
2624
withAccessibility {
2725
set(null, value)

0 commit comments

Comments
 (0)