Fix to colorband loading. Preventing a crash when less than 4 cursors are used.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9691 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
0fd34d3535
commit
4fb6ba58c7
@ -154,10 +154,10 @@ public class ColorBand {
|
|||||||
float[] ipoFactors = new float[4];
|
float[] ipoFactors = new float[4];
|
||||||
float f;
|
float f;
|
||||||
|
|
||||||
ColorBandData data0 = cbDataMap.get(currentCursor - 2);
|
ColorBandData data0 = this.getColorbandData(currentCursor - 2, cbDataMap);
|
||||||
ColorBandData data1 = cbDataMap.get(currentCursor - 1);
|
ColorBandData data1 = this.getColorbandData(currentCursor - 1, cbDataMap);
|
||||||
ColorBandData data2 = cbDataMap.get(currentCursor);
|
ColorBandData data2 = this.getColorbandData(currentCursor, cbDataMap);
|
||||||
ColorBandData data3 = cbDataMap.get(currentCursor + 1);
|
ColorBandData data3 = this.getColorbandData(currentCursor + 1, cbDataMap);
|
||||||
|
|
||||||
for (int i = 0; i < result.length; ++i) {
|
for (int i = 0; i < result.length; ++i) {
|
||||||
if (data2.pos != data1.pos) {
|
if (data2.pos != data1.pos) {
|
||||||
@ -234,6 +234,14 @@ public class ColorBand {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ColorBandData getColorbandData(int index, Map<Integer, ColorBandData> cbDataMap) {
|
||||||
|
ColorBandData result = cbDataMap.get(index);
|
||||||
|
if(result == null) {
|
||||||
|
result = new ColorBandData();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the data for either B-spline of Cardinal
|
* This method returns the data for either B-spline of Cardinal
|
||||||
@ -272,6 +280,11 @@ public class ColorBand {
|
|||||||
public final float r, g, b, a;
|
public final float r, g, b, a;
|
||||||
public int pos;
|
public int pos;
|
||||||
|
|
||||||
|
public ColorBandData() {
|
||||||
|
r = g = b = 0;
|
||||||
|
a = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user