Commit 6568a711 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

Preferences: prevent potential NullDereference

parent a773ddfd
...@@ -39,6 +39,7 @@ import android.content.DialogInterface; ...@@ -39,6 +39,7 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.graphics.drawable.Drawable.ConstantState;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
...@@ -303,10 +304,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP ...@@ -303,10 +304,11 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
Dialog dialog = ((PreferenceScreen)preference).getDialog(); Dialog dialog = ((PreferenceScreen)preference).getDialog();
if (dialog!=null) { if (dialog!=null) {
Window window = dialog.getWindow(); Window window = dialog.getWindow();
if(window != null) if (window != null) {
window.getDecorView().setBackgroundDrawable( ConstantState state = this.getWindow().getDecorView().getBackground().getConstantState();
this.getWindow().getDecorView().getBackground() if (state != null)
.getConstantState().newDrawable()); window.getDecorView().setBackgroundDrawable(state.newDrawable());
}
} }
} }
} catch(Exception e){} } catch(Exception e){}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment