summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-10-16 11:41:47 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-10-16 11:41:47 +0200
commit3f8f9be652e992def6bd3e345b850297f085a129 (patch)
tree755797226c3caea3dce88aa50835dd45d942cb6f /src/de/danoeh/antennapod
parent164ca08123646bfa8664c9eb8492ecb107e22bc6 (diff)
downloadAntennaPod-3f8f9be652e992def6bd3e345b850297f085a129.zip
Added check for null in SyndTypeUtils0.9.5.2
Diffstat (limited to 'src/de/danoeh/antennapod')
-rw-r--r--src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java b/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java
index 16ef02435..d989b7be1 100644
--- a/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java
+++ b/src/de/danoeh/antennapod/syndication/util/SyndTypeUtils.java
@@ -15,7 +15,11 @@ public class SyndTypeUtils {
}
public static boolean typeValid(String type) {
- return type.matches(VALID_MIMETYPE);
+ if (type == null) {
+ return false;
+ } else {
+ return type.matches(VALID_MIMETYPE);
+ }
}
/**
@@ -24,12 +28,14 @@ public class SyndTypeUtils {
* the type is not supported, this method will return null.
*/
public static String getValidMimeTypeFromUrl(String url) {
- String extension = FilenameUtils.getExtension(url);
- if (extension != null) {
- String type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
- extension);
- if (type != null && typeValid(type)) {
- return type;
+ if (url != null) {
+ String extension = FilenameUtils.getExtension(url);
+ if (extension != null) {
+ String type = MimeTypeMap.getSingleton()
+ .getMimeTypeFromExtension(extension);
+ if (type != null && typeValid(type)) {
+ return type;
+ }
}
}
return null;