@@ -91,7 +91,8 @@ public void modulesAdded(@NotNull Project proj, @NotNull List<? extends Module>
91
91
}
92
92
93
93
// Derived from the method in ReflectionUtil, with the addition of setAccessible().
94
- public static <T > T getStaticFieldValue (@ NotNull Class objectClass ,
94
+ @ Nullable
95
+ public static <T > T getStaticFieldValue (@ NotNull Class <?> objectClass ,
95
96
@ Nullable ("null means any type" ) Class <T > fieldType ,
96
97
@ NotNull @ NonNls String fieldName ) {
97
98
try {
@@ -168,6 +169,7 @@ public void processAttached(@NotNull DebugProcess process) {
168
169
PubRoot pubRoot = ((SdkAttachConfig )runConfig ).pubRoot ;
169
170
Application app = ApplicationManager .getApplication ();
170
171
project .putUserData (ATTACH_IS_ACTIVE , ThreeState .fromBoolean (true ));
172
+ if (app == null ) return ;
171
173
// Note: Using block comments to preserve formatting.
172
174
app .invokeLater ( /* After the Android launch completes, */
173
175
() -> app .executeOnPooledThread ( /* but not on the EDT, */
@@ -178,12 +180,16 @@ public void processAttached(@NotNull DebugProcess process) {
178
180
179
181
@ Override
180
182
public void sessionCreated (DebuggerSession session ) {
181
- session .getProcess ().addDebugProcessListener (dpl );
183
+ if (session != null ) {
184
+ session .getProcess ().addDebugProcessListener (dpl );
185
+ }
182
186
}
183
187
184
188
@ Override
185
189
public void sessionRemoved (DebuggerSession session ) {
186
- session .getProcess ().removeDebugProcessListener (dpl );
190
+ if (session != null ) {
191
+ session .getProcess ().removeDebugProcessListener (dpl );
192
+ }
187
193
}
188
194
};
189
195
}
0 commit comments