Skip to content

Commit d86a3aa

Browse files
maskaravivekmisaochan
authored andcommitted
Handle null value for artist (commons-app#2436)
1 parent 0e2bd3e commit d86a3aa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/fr/free/nrw/commons/category/CategoryImageUtils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package fr.free.nrw.commons.category;
22

3+
import android.support.annotation.NonNull;
4+
35
import org.w3c.dom.Element;
46
import org.w3c.dom.Node;
57
import org.w3c.dom.NodeList;
@@ -109,8 +111,13 @@ private static String getLicense(Node document) {
109111
* @param document
110112
* @return
111113
*/
114+
@NonNull
112115
private static String getCreator(Node document) {
113-
return StringUtils.getParsedStringFromHtml(getMetaDataValue(document, "Artist"));
116+
String artist = getMetaDataValue(document, "Artist");
117+
if (StringUtils.isNullOrWhiteSpace(artist)) {
118+
return "";
119+
}
120+
return StringUtils.getParsedStringFromHtml(artist);
114121
}
115122

116123
/**

0 commit comments

Comments
 (0)