From: <jde...@us...> - 2012-02-05 04:40:02
|
Revision: 16051 http://pcgen.svn.sourceforge.net/pcgen/?rev=16051&view=rev Author: jdempsey Date: 2012-02-05 04:39:55 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Fix bug: Character with two identical items in same location cannot be loaded Issue#: CODE-1189 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java Modified: Trunk/pcgen/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java 2012-02-05 04:15:22 UTC (rev 16050) +++ Trunk/pcgen/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java 2012-02-05 04:39:55 UTC (rev 16051) @@ -256,7 +256,12 @@ children = Collections.emptyList(); } int insertion_index = 1 + Collections.binarySearch(children, child, pathComparator); - pathMap.add(parent, -insertion_index, child); + if (insertion_index < 0) + { + // The item wasn't already in the list so the search gave us a negative index of where to add the item. + insertion_index *= -1; + } + pathMap.add(parent, insertion_index, child); return -insertion_index; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |