SoftReference / WeakReference Nullpointer
<p>Receiving a NPE on the below line</p>

<pre><code>if( mCache.containsKey(key) ){
</code></pre>

<p>Trying to use SoftReference WeakReference with hashmap while decodingFile image with the below code.</p>

<pre><code>private WeakHashMap&lt;String, SoftReference&lt;Bitmap&gt;&gt; mCache;

public Bitmap get(String key, BmpWrap image, BitmapFactory.Options options){

            File root = mContext.getFilesDir();
            String name = Activity.fullScreenActive ? image.name + ".png" : image.name
                    + ".stat.png";
            File img = new File(root, name);

            if(key == null){
                return null;
            }
            if( mCache.containsKey(key) ){
                SoftReference&lt;Bitmap&gt; reference = mCache.get(key);
                image.bmp = reference.get();
                if( image.bmp != null ){
                    return image.bmp;
                }
                image.bmp = BitmapFactory.decodeFile(img.getAbsolutePath(), options);
                mCache.put(key, new SoftReference&lt;Bitmap&gt;(image.bmp));
                return image.bmp;
            }

            if( img.exists() ){
                image.bmp = BitmapFactory.decodeFile(img.getAbsolutePath(), options);
                mCache.put(key, new SoftReference&lt;Bitmap&gt;(image.bmp));
                return image.bmp;
            } else{
                throw new RuntimeException("Boooom!");
            }
        }

        private void scaleImage(BmpWrap image, BitmapFactory.Options options)

        {
            options.inTempStorage = new byte[16 * IMG_BUFFER_LEN];
            options.inPreferredConfig = Bitmap.Config.RGB_565;
            options.inDither = false;


            try {
                Field f = options.getClass().getField("inPurgeable");
                f.set(options, Boolean.TRUE);

                Field f2 = options.getClass().getField("inInputShareable");
                f2.set(options, Boolean.TRUE);
            } catch (Exception ignore) {
            }

            File root = mContext.getFilesDir();
            String name = Activity.fullScreenActive ? image.name + ".png" : image.name
                    + ".stat.png";
            File img = new File(root, name);

            // maybe it's jpeg
            if (!img.exists()) {
                img = new File(root, name.replace(".png", ".jpg"));
            }

            if (img.exists()) {

                if (image.bmp == null || Activity.fullScreenSwitch) {
                    if (image.bmp != null)
                    image.bmp.recycle();
                    image.bmp = null;
                    **get(name, image, options);**
                    //image.bmp = BitmapFactory.decodeFile(img.getAbsolutePath(), options);
                } else if (image.bmp == null) {
                    image.bmp = BitmapFactory.decodeResource(getResources(),
                            getResourceByString(image.name), options);
                }
            } else {
                image.bmp = BitmapFactory.decodeResource(getResources(),
                        getResourceByString(image.name), options);
            }
        }
</code></pre>

<p>Stack</p>

<pre><code>12-16 18:30:42.724: E/AndroidRuntime(9955): FATAL EXCEPTION: main
12-16 18:30:42.724: E/AndroidRuntime(9955): java.lang.RuntimeException: Boooom!
12-16 18:30:42.724: E/AndroidRuntime(9955):     at com.apk.View$Thread.get(View.java:259)
12-16 18:30:42.724: E/AndroidRuntime(9955):     at com.apk.View$Thread.scaleImage(View.java:296)
12-16 18:30:42.724: E/AndroidRuntime(9955):     at com.apk.View$Thread.resizeImages(View.java:326)
12-16 18:30:42.724: E/AndroidRuntime(9955):     at com.apk.View$Thread.setSurfaceSize(View.java:515)
12-16 18:30:42.724: E/AndroidRuntime(9955):     at com.apk.View.surfaceChanged(View.java:889)
</code></pre>
