am 2ef0d3bf: Merge "fix possible NPE in DebugSettings"

* commit '2ef0d3bf8db57ebebcb1c10f5b378a36b33ba1eb':
  fix possible NPE in DebugSettings
main
satok 2013-01-10 03:20:10 -08:00 committed by Android Git Automerger
commit 9fa1bc4148
1 changed files with 3 additions and 0 deletions

View File

@ -107,6 +107,9 @@ public final class DebugSettings extends PreferenceFragment
String version = ""; String version = "";
try { try {
final Context context = getActivity(); final Context context = getActivity();
if (context == null) {
return;
}
final String packageName = context.getPackageName(); final String packageName = context.getPackageName();
PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0); PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
version = "Version " + info.versionName; version = "Version " + info.versionName;