OSDN Git Service

Fix bug 2389454 - DateTimeView can NPE if "date_format" isn't set in Settings.
authorJoe Onorato <joeo@android.com>
Mon, 1 Feb 2010 23:14:15 +0000 (18:14 -0500)
committerJoe Onorato <joeo@android.com>
Mon, 1 Feb 2010 23:14:15 +0000 (18:14 -0500)
core/java/android/widget/DateTimeView.java

index 9067e26..3dab9f2 100644 (file)
@@ -203,7 +203,7 @@ public class DateTimeView extends TextView {
     private DateFormat getDateFormat() {
         String format = Settings.System.getString(getContext().getContentResolver(),
                 Settings.System.DATE_FORMAT);
-        if ("".equals(format)) {
+        if (format == null || "".equals(format)) {
             return DateFormat.getDateInstance(DateFormat.SHORT);
         } else {
             return new SimpleDateFormat(format);