From: Michał B. <ba...@tl...> - 2008-02-17 17:58:34
|
Hi, I have recently played a game of 18AL, found 4 or 5 bugs, and decided to try to see if I can fix some of them... I downloaded sources from cvs, and kept on getting a NullPointer right after clicking 'New Game'. I tracked that down to some code in PublicCompany.java that is a cut and paste code from CompanyManager.java: // BaseToken Tag baseTokenTag = tag.getChild("BaseTokens"); // Cost of laying a token Tag layCostTag = baseTokenTag.getChild("LayCost"); String costMethod = layCostTag.getAttributeAsString("method"); // Must validate the cost method! baseTokenLayCost = layCostTag.getAttributeAsIntegerArray("cost"); /* Cost of buying a token (mutually exclusive with laying cost) */ Tag buyCostTag = tag.getChild("BuyCost"); // We don't have this yet - ignore for now. Tag tokenLayTimeTag = tag.getChild("HomeBase"); if (tokenLayTimeTag != null) { String layTimeString = tokenLayTimeTag.getAttributeAsString("lay"); if (Util.hasValue(layTimeString)) { for (int i = 0; i < tokenLayTimeNames.length; i++) { if (tokenLayTimeNames[i].equalsIgnoreCase(layTimeString)) { homeBaseTokensLayTime = i; break; } } } } (lines 463 to 488 in PublicCompany.java). Commenting this code out results in everything seemingly working fine... So my question: what am I doing wrong? Did I checkout code I wasn't supposed to, and I should check out a branch of a stable version (how?)? Or is the code fine as it is and my NullPointer is me doing something wrong along the way? I am a bit reluctant to try fixing anything while not understatnding what's the deal with this NullPointer... Best regards, Mike Bazynski |