Fix null pointer?

This commit is contained in:
Karim Abou Zeid 2018-06-27 10:04:53 +02:00
commit af3dab4930

View file

@ -122,8 +122,12 @@ public class CustomArtistImageUtil {
}
private static String getFileName(Artist artist) {
String artistName = artist.getName();
if (artistName == null)
artistName = "";
// replace everything that is not a letter or a number with _
return String.format(Locale.US, "#%d#%s.jpeg", artist.getId(), artist.getName().replaceAll("[^a-zA-Z0-9]", "_"));
artistName = artistName.replaceAll("[^a-zA-Z0-9]", "_");
return String.format(Locale.US, "#%d#%s.jpeg", artist.getId(), artistName);
}
public static File getFile(Artist artist) {