[fixes #927] Q&D fix for NullPointerException upon no motors sim run
This commit is contained in:
parent
09ac23a54c
commit
894ac89733
@ -18,10 +18,20 @@ public abstract class InterpolatingAtmosphericModel implements AtmosphericModel
|
|||||||
if (levels == null)
|
if (levels == null)
|
||||||
computeLayers();
|
computeLayers();
|
||||||
|
|
||||||
if (altitude <= 0)
|
if (altitude <= 0) {
|
||||||
|
// TODO: LOW: levels[0] returned null in some cases, see GitHub issue #952 for more information
|
||||||
|
if (levels[0] == null) {
|
||||||
|
computeLayers();
|
||||||
|
}
|
||||||
return levels[0];
|
return levels[0];
|
||||||
if (altitude >= DELTA * (levels.length - 1))
|
}
|
||||||
|
if (altitude >= DELTA * (levels.length - 1)) {
|
||||||
|
// TODO: LOW: levels[levels.length - 1] returned null in some cases, see GitHub issue #952 for more information
|
||||||
|
if (levels[levels.length - 1] == null) {
|
||||||
|
computeLayers();
|
||||||
|
}
|
||||||
return levels[levels.length - 1];
|
return levels[levels.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
int n = (int) (altitude / DELTA);
|
int n = (int) (altitude / DELTA);
|
||||||
double d = (altitude - n * DELTA) / DELTA;
|
double d = (altitude - n * DELTA) / DELTA;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user