🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

More info on null ref exception

Started by
0 comments, last by WitchLord 7 years, 3 months ago

It would be nice to get some more info in a null ref exception message. For example, take this code:

m_grid.m_netricsa.m_wPerkInfo.m_visible = false;

If we got a null ref exception here and all m_* members are handles, how do we know which one is null? Could Angelscript say something like "m_wPerkInfo is null"?

Also, when we're on the topic of null references, what about the null conditional operator "?." ? Would that be something that could be implemented?

Advertisement

Null conditional operator? It's the first time I've heard this term. In what programming language is that available? It sounds interesting and may be something that can be implemented.

About adding more information on the exception. I'll look into it, but it may not be that easy, and would probably require extensive changes just to carry the information to the VM so it would have the information available at the time of raising the exception. I'm not too sure it would be worth it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement