Nullereference Not set to an instance..

08/07/2014 23:45 EOS 60D#1
so i had this null reference errror. i dont get it why its null ..


so im loading

public Map WaitingArea;

Code:
WaitingArea = Kernel.Maps[ElitePKTournament.WaitingAreaID].MakeDynamicMap();
EPK WatingAreaID
public const ulong WaitingAreaID = 2068;
08/07/2014 23:57 abdeen#2
Quote:
Originally Posted by EOS 60D View Post
so i had this null reference errror. i dont get it why its null ..


so im loading

public Map WaitingArea;

Code:
WaitingArea = Kernel.Maps[ElitePKTournament.WaitingAreaID].MakeDynamicMap();
EPK WatingAreaID
public const ulong WaitingAreaID = 2068;
Breakpoint this line and check values to know where is the null ....
08/08/2014 00:58 abdoumatrix#3
cuz ur maps don't contain map with id = 2068
08/08/2014 05:23 pintinho12#4
Quote:
Originally Posted by abdeen View Post
Breakpoint this line and check values to know where is the null ....
The null is where he doesnt have that map added to the dictionary/list...
So he is trying to make reference to something that doesnt exist

I recommend using a

Code:
if(!Kernel.Maps.ContainsKey(ElitePKTournament.WaitingAreaID)){
Handle something alternative or add the map before
}
08/08/2014 11:44 abdeen#5
Quote:
Originally Posted by pintinho12 View Post
The null is where he doesnt have that map added to the dictionary/list...
So he is trying to make reference to something that doesnt exist

I recommend using a

Code:
if(!Kernel.Maps.ContainsKey(ElitePKTournament.WaitingAreaID)){
Handle something alternative or add the map before
}
Or he can just add map with this id [2068] to the database and it will be loaded at server launch ...
08/08/2014 11:46 abdoumatrix#6
Quote:
Originally Posted by pintinho12 View Post
The null is where he doesnt have that map added to the dictionary/list...
So he is trying to make reference to something that doesnt exist

I recommend using a

Code:
if(!Kernel.Maps.ContainsKey(ElitePKTournament.WaitingAreaID)){
Handle something alternative or add the map before
}
xD this will just stop the error but the more will come sooner

he had to put new map 2068

PHP Code:
2068    2068    0    0 
08/08/2014 11:51 Yupmoh#7
You need to initialize an instance of that object before calling it. It's really simple, If it's not there you'll get a NRE.
08/08/2014 15:55 EOS 60D#8
Its fixed now.. thank you guys for the replies .. appreciate it.. its the map not added on the map path..