views:

127

answers:

2

Hi,

I'm having a weird problem with adding stuff to my Container. Whenever I try to add the items it simply exits the while loop, even though isServer is still 1. I've tried to make a custom function, same result. Then i tried calling the Add(..) function directly and still same result. I don't see how inserting items to my container is supposed to exit the loop? Here's the gamedata class:

+3  A: 

Is it possible that you could be getting an Exception? Some of the higher-up code may be catching and tossing the exception. Try wrapping the HandleSListPacket method in a Try/Catch block, and use a custom dialog to display the Exception.

try {
   // HandleSListPacket() code goes here
}
catch (Exception ex) {
   MessageBox.Show("Caught Exception: " + ex);
   throw;
}
Spodi
Totally forgot about that! Thank you, it threw this exception:System.NullReferenceException: Object reference not set to an instance of an object.
A: 

To piggyback on Spodi's answer, is it possible that you're adding duplicate keys to the ServerList? This is not permitted with the Dictionary type, so if 2 identical realServerName values are added an exception would be thrown.

John Rasch
I have found the mistake, I haven't initialized the gamedata class properly, duh! Thanks for your help!