[Desc.] compare floating value, potential null pointer exception
[Issue] -
public void setHeightRatio(double ratio) {
originalHeightRatio = ratio;
- if (getBoardItemHeightRatio() == DAChartBoard.ITEM_HEIGHT_RATIO_SHORT) {
+ if (Double.compare(getBoardItemHeightRatio(), DAChartBoard.ITEM_HEIGHT_RATIO_SHORT) == 0) {
heightRatio = DAChartBoard.ITEM_HEIGHT_RATIO_SHORT;
} else {
heightRatio = ratio;
} else if (childFolded) {
return (int) (heightRatio * DEFAULT_ITEM_HEIGHT);
} else {
- return (int) (heightRatio * DEFAULT_ITEM_HEIGHT + childItemList
- .getListHeight());
+ if (childItemList != null) {
+ return (int) (heightRatio * DEFAULT_ITEM_HEIGHT + childItemList
+ .getListHeight());
+ } else {
+ return 0;
+ }
}
}