Fix issue #2549955: Moving the application fails -Activity Manager Crash on launching the app

mResources will be null if we failed loading them because the app
is on external storage that has been unmounted.

Change-Id: If0dbbdc0c3441fa10d0ab074568361524db1c8db
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index b07b690..950f34f 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1482,8 +1482,9 @@
         mPackageInfo = packageInfo;
         mResources = mPackageInfo.getResources(mainThread);
 
-        if (container != null && container.getCompatibilityInfo().applicationScale !=
-            mResources.getCompatibilityInfo().applicationScale) {
+        if (mResources != null && container != null
+                && container.getCompatibilityInfo().applicationScale !=
+                        mResources.getCompatibilityInfo().applicationScale) {
             if (DEBUG) {
                 Log.d(TAG, "loaded context has different scaling. Using container's" +
                         " compatiblity info:" + container.getDisplayMetrics());