Open ddyer0 opened 4 years ago
Can you share the NPE stacktrace?
Not easily - the standard environment has a printStackTrace but not a getStackTrace which I could use to show the trace in the error message. I have a stack trace from my actual app, but it's not partiularly informative, it ends at the method that contains the code of interest.
Stack trace from the actual app
What is line 625 of commonGameViewer?
At 09:57 AM 5/19/2020, Steve Hannah wrote:
What is line 625 of commonGameViewer?
those are not line numbers, they're some gibberish whose interpretation is known only to xcode.
I found the x = y = Math.min as the culprit line by binary search.
those are not line numbers
Those should be line numbers.
they're not. The might be line numbers in the xcode source. The key line in the actual app is 887, and it contains this newBoardScaleIndex = boardScaleIndex = Math.min(NumBoardScaleIndices-1,(int)(isi*SCALE));
maybe you have a stack trace tool that knows how to unwind the xcode numbers?
Oh. Sorry... I mistook that stack trace for the one that codename one generates on iOS.
Yea, that's one of my pet peeves about codename1 - you classified stack traces as a premium feature, where IMO they are actually essential debugging tools.
If you catch the exception and print it with Log.e(ex), it will print out the stack with java line numbers.
That's exactly what I do, but I don't get the good line numbers. Some other calestentics are necessary to get it to a string instead of printed to stderr.
''''java
public static String getStackTrace(Throwable t)
{ int level = LogCapture.getLevel();
LogCapture cap = new LogCapture();
LogCapture.setLevel(99);
Log.e(t);
LogCapture.setLevel(level);
return cap.dispose();
}
''''
The attached program does some simple arithmetic (with no pointers) and encounters a nullPointerException on IOS only. The key point that induces the error seems to be the chained assignment found in the function init()