fix possible NPE in DebugSettings

Change-Id: I44ec5bd3b2a00087603316f14d732164dbcf399f
main
satok 2013-01-10 19:57:33 +09:00
parent 6512cd289d
commit e8b4fd2644
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;