Bad handling of multi-condition if statements with initial nil check

In .2435 I am suddenly getting NullPointer crashes when doing a multi-condition if check where the initial check is for null state.

var sTest: String;
if (sTest <> nil) and (sTest.length() > 0) then
  ;

I get a crash on sTest.length() since sTest is nil.

I did skip a couple releases, so I’m not sure which exact build this popped up in. It worked for me in .2425 but now does not in .2435.

[EDIT]
Sorry, previous test case was bad. Here’s a simple test case:
org.me.androidapplication.zip (14.6 KB)

Thanks, logged as bugs://83184

1 Like

This was a very curious bug that’s been there for a while but never really showed when using constant nils. If you want a quick fix, grab latest:

compile it, and copy the cooper.jar file it builds in C:\Program Files (x86)\RemObjects Software\Elements\References\Cooper

Your project will work fine then.

1 Like

bugs://83184 got closed with status fixed.

Looks good now, thanks Carlo!

2 Likes