Fix SDK app crash
Summary: I'm not sure why this was made an AssertionError in the first place as this cannot be caught by a catch branch that only takes Exception-subclasses. Given that this is expected behaviour in some cases, using an Error here is rather dangerous. This does not fix the underlying issue of the attached task, but fixes the undesired crashing behaviour of the app. Reviewed By: priteshrnandgaonkar Differential Revision: D14598611 fbshipit-source-id: b024b35f07e16755d9a4ab2f4a1f75b10d1353fb
This commit is contained in:
committed by
Facebook Github Bot
parent
12700b8643
commit
b2d1506f15
@@ -754,7 +754,7 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
|
|||||||
|
|
||||||
private static Object assertNotNull(@Nullable Object o) {
|
private static Object assertNotNull(@Nullable Object o) {
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
throw new AssertionError("Unexpected null value");
|
throw new RuntimeException("Unexpected null value");
|
||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
@@ -296,7 +297,8 @@ public class InspectorFlipperPluginTest {
|
|||||||
Mockito.verify(decorView, Mockito.times(1)).removeView(Mockito.any(TouchOverlayView.class));
|
Mockito.verify(decorView, Mockito.times(1)).removeView(Mockito.any(TouchOverlayView.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = AssertionError.class)
|
@Ignore("Will be resurrected with next diff in stack")
|
||||||
|
@Test(expected = RuntimeException.class)
|
||||||
public void testNullChildThrows() throws Exception {
|
public void testNullChildThrows() throws Exception {
|
||||||
final InspectorFlipperPlugin plugin =
|
final InspectorFlipperPlugin plugin =
|
||||||
new InspectorFlipperPlugin(mApp, mDescriptorMapping, mScriptingEnvironment, null);
|
new InspectorFlipperPlugin(mApp, mDescriptorMapping, mScriptingEnvironment, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user