We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Checking for null pointers
Page Index Toggle Pages: 1
Checking for null pointers (Read 548 times)
Checking for null pointers
Nov 7th, 2009, 10:32am
 
I've got a pretty sizable array to sort through (say, [4000][4]), and the dataset it's built from occasionally has missing fields. When working with certain datasets, I'll hit a missing entry in the array, and get thrown a Null Pointer error.
Is there any way to check whether an array value is null before attempting to operate on it?
Re: Checking for null pointers
Reply #1 - Nov 7th, 2009, 2:22pm
 
Yes.
Just do if (arr[i] != null)
Page Index Toggle Pages: 1