Skip to content

Commit

Permalink
NPE TermColorKeywordImpl.toString radkovo#100
Browse files Browse the repository at this point in the history
  • Loading branch information
dmercuriali committed May 31, 2019
1 parent 4cf1c97 commit 8546265
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 62 deletions.
17 changes: 11 additions & 6 deletions src/main/java/cz/vutbr/web/csskit/TermColorKeywordImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @author Radek Burget
*/
public class TermColorKeywordImpl extends TermImpl<Color> implements TermColor {

private Keyword keyword;

protected TermColorKeywordImpl(Keyword keyword, int r, int g, int b, int a) {
Expand All @@ -24,18 +24,23 @@ protected TermColorKeywordImpl(Keyword keyword, int r, int g, int b, int a) {
public Keyword getKeyword() {
return keyword;
}

@Override
public boolean isTransparent() {
return (keyword == Keyword.TRANSPARENT) || (value.getAlpha() == 0);
}

@Override
public String toString() {
if (operator != null)
return operator.value() + keyword.toString();
else
return keyword.toString();
String operatorValue = operator == null
? ""
: operator.value();

String keywordStr = keyword == null
? ""
: keyword.toString();

return operatorValue + keywordStr;
}

}
Loading

0 comments on commit 8546265

Please sign in to comment.