Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
spectre.harvey
spectre.harvey's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Need help with NPE?
[3 Replies]
21-Dec-2012 05:35 PM
Forum:
Programming Questions
Here is the code where it is happening:
//Up in the global declarations:
color[] colors;
void setup(){
//Stuff in here
createColors();
}
void draw(){
//Stuff in here
}
void createColors(){
int var1 = height/50;
int var2 = width/100;
for(int i = 0; i < var2; i++){
for(int j = 0; i < var1; j++){
float r, g, b;
r = random(255);
g = random(255);
b = random(255);
color newColor = color(r, g, b);
colors[i+j] = newColor;
}
}
}
In line 26 of the above code, I get a NPE.
Instead of line 25 and line 26, I have tried the alternative options and I still get the same NPE:
colors[i+j] = color(r, g, b);
And also manually:
colors[i+j] = color(255, 255, 255);
If anyone could please point out my errors, I would much appreciate it!
Thank You
«Prev
Next »
Moderate user : spectre.harvey
Forum