return entry;
}
- /* Skip this entry if its name cannot be represented. */
+ /* Skip this entry if its name cannot be represented. NAME
+ can still be null here, since some Cursors are permitted to
+ return NULL if INDEX is not a string. */
- if (name.equals ("..") || name.equals (".") || name.contains ("/"))
+ if (name == null || name.equals ("..")
+ || name.equals (".") || name.contains ("/")
+ || name.contains ("\0"))
continue;
/* Now, look for its type. */
/* If DIR is an asset directory or a content directory, return
the home directory instead. */
- if (encode && (!strcmp (SSDATA (dir), "/assets")
- || !strncmp (SSDATA (dir), "/assets/", 8)
- || !strcmp (SSDATA (dir), "/content")
- || !strncmp (SSDATA (dir), "/content/", 9)))
+ if (encode
+ && (android_is_special_directory (SSDATA (dir),
+ "/assets")
+ || android_is_special_directory (SSDATA (dir),
+ "/content")))
dir = build_string ("~");
#endif /* HAVE_ANDROID && ANDROID_STUBIFY */