Jump to content
Sign in to follow this  
Sqwince

Help with map.get() returns NULL

Recommended Posts

Trying to figure out why I keep getting NULL pointer references when working with the map<int,object>.get(int). From the debugger it looks like I am properly setting the key as int = 1. The value is an object reference. When I use map.get(1) it returns NULL. Any tips or suggestions? Is this implementation valid? Ot should I just work with arrays instead? Final array would just be the same size as number of players.

Share this post


Link to post
Share on other sites

For anyone who also runs into this, I think I figured it out. When dealing with Objects in the map have to use "ref" in the type def in the map. 
protected ref map<int, ref MyClass> myMap = new ref map<int, ref MyClass>;

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×