summaryrefslogtreecommitdiffstats
path: root/tools/layoutlib
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2013-10-16 20:27:51 -0700
committerDeepanshu Gupta <deepanshu@google.com>2014-05-05 18:23:15 -0700
commit64dc0380127047ffcf135b6848c9150aa8dbed85 (patch)
tree7a91446d1791bbcbe997a68c66b26e814c5d902a /tools/layoutlib
parenta59c27dd6674a31c875b0baa86519caec628ca2d (diff)
downloadframeworks_base-64dc0380127047ffcf135b6848c9150aa8dbed85.zip
frameworks_base-64dc0380127047ffcf135b6848c9150aa8dbed85.tar.gz
frameworks_base-64dc0380127047ffcf135b6848c9150aa8dbed85.tar.bz2
Fix layoutlib [DO NOT MERGE]
Fix a NPE. The cherry-pick differs slightly from the original to remove changes not relevant to the current branch. Bug: 11140701 Change-Id: Id92fc5359acf6dde1bcdbc781aaf637fdb6eecbf (cherry-picked from 87be67f91719234cbd381ff0242b5efc8b6aa257)
Diffstat (limited to 'tools/layoutlib')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
index b20f190..60b20a6 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
@@ -246,11 +246,16 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
* The counterpart is {@link #setUp()}.
*/
private void tearDown() {
- // Make sure to remove static references, otherwise we could not unload the lib
- mContext.disposeResources();
+ // The context may be null, if there was an error during init().
+ if (mContext != null) {
+ // Make sure to remove static references, otherwise we could not unload the lib
+ mContext.disposeResources();
+ }
- // quit HandlerThread created during this session.
- HandlerThread_Delegate.cleanUp(sCurrentContext);
+ if (sCurrentContext != null) {
+ // quit HandlerThread created during this session.
+ HandlerThread_Delegate.cleanUp(sCurrentContext);
+ }
// clear the stored ViewConfiguration since the map is per density and not per context.
ViewConfiguration_Accessor.clearConfigurations();
@@ -261,8 +266,12 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
sCurrentContext = null;
Bridge.setLog(null);
- mContext.getRenderResources().setFrameworkResourceIdProvider(null);
- mContext.getRenderResources().setLogger(null);
+ if (mContext != null) {
+ mContext.getRenderResources().setFrameworkResourceIdProvider(null);
+ mContext.getRenderResources().setLogger(null);
+ }
+
+ mContext = null;
}
public static BridgeContext getCurrentContext() {