diff options
| author | 2014-05-02 19:19:52 +0000 | |
|---|---|---|
| committer | 2014-05-02 19:19:52 +0000 | |
| commit | 27f0cf0b135917b52fea14406e806b35e721949e (patch) | |
| tree | 3da6a2c568f4b0ddbfc3235e8845db21a9b490c9 | |
| parent | 5c7a844ca19873a03bac861ed021bdeea3712ca8 (diff) | |
| parent | 10fd7f6b4192fdbd847106fb0d9ec87095092ee3 (diff) | |
am 10fd7f6b: am ca2c6307: am 87be67f9: Fix layoutlib [DO NOT MERGE]
* commit '10fd7f6b4192fdbd847106fb0d9ec87095092ee3':
Fix layoutlib [DO NOT MERGE]
| -rw-r--r-- | tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java | 21 |
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 0963c2e1725f..5cb49d3b1dc0 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 @@ -248,11 +248,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(); @@ -263,8 +268,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() { |