Unsure if related, but I'm using LibGDX and maintaining a long-existing app on Google Play.
In a recent update, I started receiving sporadic, random crashes. They all looked like this:
There seems to be no common denominator for the reason, device, or OS (only Android 9, and 10 however).
The code in question has never changed, it's been in place for years. The underlying Table/Cell (LibGDX) code is also very much the same, and unchanged. Here is the line causing the problem:
Table importTable = new Table();
importTable.pad(0).align(Align.center);
importTable.defaults().pad(0).space(0).spaceRight(10 * App.assetScaling).expandX();
Function:
/** The space cannot be < 0. */
public Cell<T> spaceRight (float spaceRight) {
if (spaceRight < 0) throw new IllegalArgumentException("spaceRight cannot be < 0: " + spaceRight);
this.spaceRight = Fixed.valueOf(spaceRight);
return this;
}
Specifically, the code spaceRight(10 * App.assetScaling)
App.assetScaling is either 1.0f or 0.5f, it is set at the app's creation. It never changes. This code runs right after the app starts, as it's creating menus and whatnot.
How...is this somehow evaluating to < 0? Or, as the error reports show, it's actually "basically 0", just with some floating point error. The number App.assetScaling is NEVER set to not either 0.5f or 1.0f.
For people plagued with this, they cannot start the app, as it keeps crashing. Upon uninstall/reinstall, however, it was fixed.
Is there...any caveat with compilation/app updates (caching?...) that, would cause math to, "break", so to speak? This error came out of nowhere a few updates ago, I've since pushed out other updates, and this crash seems to be dwindling but, not gone completely...
from Math is broken in my Android app's recent update(s)

No comments:
Post a Comment