BloggerTutorialBD / fallenswordhelper

Automatically exported from code.google.com/p/fallenswordhelper
0 stars 0 forks source link

Fast wear is broken (if you have no enemies?) #431

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

There was a syntax error: aCell.firstChild.firstChild.nextSibling is null
line 3319

I get around the error by commenting out these lines:
//var enemyNameTable = aCell.firstChild.firstChild.nextSibling.nextSibling;
//var enemyName = enemyNameTable.rows[0].cells[1].firstChild.textContent;
//listOfEnemies += enemyName + " ";

This worked in r616. If it matters, I have no enemies.

Original issue reported on code.google.com by grim...@yahoo.com on 26 Feb 2009 at 2:32

GoogleCodeExporter commented 9 years ago

Original comment by fraserst...@gmail.com on 26 Feb 2009 at 4:30

GoogleCodeExporter commented 9 years ago
Fixed bug that broke fast wear when you had no allies or enemies

Original comment by fraserst...@gmail.com on 6 Mar 2009 at 12:41

GoogleCodeExporter commented 9 years ago
Fixed in r641.

Original comment by fraserst...@gmail.com on 6 Mar 2009 at 12:43

GoogleCodeExporter commented 9 years ago
Still is broken, enemiesTableActual.rows.length has a value of 1 for me (I have 
no
enemies), so the same null pointer error still occurs.

Original comment by grim...@yahoo.com on 6 Mar 2009 at 2:45

GoogleCodeExporter commented 9 years ago
Sigh ... I will try again next time.

Original comment by fraserst...@gmail.com on 6 Mar 2009 at 3:11

GoogleCodeExporter commented 9 years ago
Just check if that's null, and break?

Original comment by grim...@yahoo.com on 6 Mar 2009 at 3:15

GoogleCodeExporter commented 9 years ago
First of all, it's not a pointer - this is javascript not C++ :)

Second: breaking (or "swallowing" exceptions) without really understanding and 
handling the reason of the problem is very bad practice.

Original comment by GSchizas on 6 Mar 2009 at 9:45

GoogleCodeExporter commented 9 years ago
Suggestion for fixing:
Move 
var numberOfEnemies = 0; (which is the true count for your enemies)
outside of the if block it's in, and then wrap the for loop
for (var i=0;i<enemiesTableActual.rows.length;i++)

inside of 
if (numberOfEnemies > 0)
{
  for (var i=0;i<enemiesTableActual.rows.length;i++)
  ...
  ...
}

This would obviously work for allies also.

Original comment by grim...@yahoo.com on 6 Mar 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Fixed again in r653.

Original comment by fraserst...@gmail.com on 10 Mar 2009 at 8:35

GoogleCodeExporter commented 9 years ago
Still broken, with aCell.firstChild.firstChild.nextSibling being null.  

enemiesTable is not null, so it still goes to enemies processing.

Original comment by grim...@yahoo.com on 11 Mar 2009 at 1:09

GoogleCodeExporter commented 9 years ago
I will try again then.

Original comment by fraserst...@gmail.com on 11 Mar 2009 at 11:16

GoogleCodeExporter commented 9 years ago
Test r659 and see if I got it this time ...

Original comment by fraserst...@gmail.com on 13 Mar 2009 at 4:18

GoogleCodeExporter commented 9 years ago
Looks like it's working now, thanks.

Original comment by grim...@yahoo.com on 13 Mar 2009 at 1:06