Reputation: 1
I have a quick question about a piece of code that I wrote:
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
map.Add(main.Stone);
Vector2 vec = new Vector2(x * 16, y * 16);
pos.Add(vec);
}
}
I get an error at pos.Add(vec);
saying that the reference is null
even though I declared it in the line above. I am pretty new to XNA so it's probably something really simple, but I can't seem to figure it out.
Upvotes: 0
Views: 720
Reputation: 48568
pos
is null.
vec
cannot be null as it is declared above using value type entity (integers).
Check using debugger.
Upvotes: 1
Reputation: 2417
pos
is the reference that is null, not vec
. Where did you declare pos
?
Upvotes: 0