Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for a problem reading wad file #18

Closed
mindbaffle opened this issue Aug 26, 2014 · 1 comment
Closed

Fix for a problem reading wad file #18

mindbaffle opened this issue Aug 26, 2014 · 1 comment

Comments

@mindbaffle
Copy link

This might help others looking at this. I used a doom1.wad I found and copied it to the web folder and named it doom.wad. After opening the root of this project in the Dart Editor and running it, the code stopped on the WAD_Image.parse line saying that getByteData wasn't defined on a null object. So I had to check to make sure the pname was a valid key by adding "if(header.lumpInfoMap.containsKey(pname))" as you see below in this portion of the wad.dart file. Then it all worked fine.

void readPatches(ByteData data) {
int count = data.getInt32(0, Endianness.LITTLE_ENDIAN);
for (int i=0; i<count; i++) {
String pname = readString(data, 4+i*8, 8);

  if(header.lumpInfoMap.containsKey(pname)) // *added this line*
  { // *added this line*
    WAD_Image patch = new WAD_Image.parse(header.lumpInfoMap[pname].getByteData(data), palette.palettes[0]);
    patchMap[pname] = patch;
    patchList.add(patch);
  } // *added this line*
}

}

@xNotch
Copy link
Owner

xNotch commented Aug 26, 2014

Fixed, thank you

@xNotch xNotch closed this as completed Aug 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants