NPE fix
This commit is contained in:
parent
d79e19c005
commit
7697ac95a7
2 changed files with 24 additions and 6 deletions
|
@ -1,9 +1,9 @@
|
|||
group = org.xbib.graphics
|
||||
name = graphics
|
||||
version = 4.0.4
|
||||
version = 4.0.5
|
||||
|
||||
gradle.wrapper.version = 6.6.1
|
||||
pdfbox.version = 2.0.23
|
||||
pdfbox.version = 2.0.24
|
||||
jna.version = 5.8.0
|
||||
zxing.version = 3.3.1
|
||||
reflections.version = 0.9.11
|
||||
|
|
|
@ -33,17 +33,21 @@ public abstract class AxesChartSeriesNumericalNoErrorBars extends MarkerSeries {
|
|||
@Override
|
||||
protected void calculateMinMax() {
|
||||
List<Double> xMinMax = findMinMax(xData);
|
||||
if (xMinMax != null) {
|
||||
setXMin(xMinMax.get(0));
|
||||
setXMax(xMinMax.get(1));
|
||||
}
|
||||
List<Double> yMinMax;
|
||||
if (extraValues == null) {
|
||||
yMinMax = findMinMax(yData);
|
||||
} else {
|
||||
yMinMax = findMinMaxWithErrorBars(yData, extraValues);
|
||||
}
|
||||
if (yMinMax != null) {
|
||||
setYMin(yMinMax.get(0));
|
||||
setYMax(yMinMax.get(1));
|
||||
}
|
||||
}
|
||||
|
||||
List<Double> findMinMax(List<?> data) {
|
||||
if (data == null) {
|
||||
|
@ -82,6 +86,20 @@ public abstract class AxesChartSeriesNumericalNoErrorBars extends MarkerSeries {
|
|||
if (bd.doubleValue() > max) {
|
||||
max = bd.doubleValue();
|
||||
}
|
||||
} else if (dataPoint instanceof Long) {
|
||||
long i = (Long) dataPoint;
|
||||
if (min == null) {
|
||||
min = (double) i;
|
||||
}
|
||||
if (max == null) {
|
||||
max = (double) i;
|
||||
}
|
||||
if (i < min) {
|
||||
min = (double) i;
|
||||
}
|
||||
if (i > max) {
|
||||
max = (double) i;
|
||||
}
|
||||
} else if (dataPoint instanceof Integer) {
|
||||
int i = (Integer) dataPoint;
|
||||
if (min == null) {
|
||||
|
|
Loading…
Reference in a new issue