- NPE prevention in CardDetailUtil.

This commit is contained in:
Agetian
2017-02-01 04:30:13 +00:00
parent 33a218f707
commit 8279aa57d2

View File

@@ -300,15 +300,17 @@ public class CardDetailUtil {
// text changes
final Map<String, String> changedColorWords = card.getChangedColorWords();
final Map<String, String> changedTypes = card.getChangedTypes();
if (changedColorWords != null && changedTypes != null) {
if (!(changedColorWords.isEmpty() && changedTypes.isEmpty())) {
if (area.length() != 0) {
area.append("\n");
}
}
for (final Entry<String, String> e : Sets.union(changedColorWords.entrySet(), changedTypes.entrySet())) {
// ignore lower case and plural form keys, to avoid duplicity
if (Character.isUpperCase(e.getKey().charAt(0)) &&
!CardUtil.singularTypes.containsKey(e.getKey())) {
if (Character.isUpperCase(e.getKey().charAt(0))
&& !CardUtil.singularTypes.containsKey(e.getKey())) {
area.append("Text changed: all instances of ");
if (e.getKey().equals("Any")) {
if (changedColorWords.containsKey(e.getKey())) {
@@ -326,6 +328,7 @@ public class CardDetailUtil {
area.append(".\n");
}
}
}
// counter text
if (card.getCounters() != null) {