summer icon indicating copy to clipboard operation
summer copied to clipboard

incorrect iteration over maps

Open kpentchev opened this issue 13 years ago • 1 comments

When I try to iterate over a Map<String,Map<String, Object> with the followin code, a NPE is always thrown, because the 'item' var is always an empty string(most probably null before some casting occurs) in the second 'data-repeat' attribute statement.

 <ul data-repeat="${listAnnComparator.sortList(annotations.keySet())}" data-var="item">

   <li data-rendered="${item != 'sections' && item != 'debugAnnotations'}">
    <span>${item}</span>
    <ul data-repeat="${listAnnComparator.sortList(annotations.get(item).keySet())}" data-var="item2" data-rendered="${annotations.hasNext(item)}">

kpentchev avatar Jun 11 '12 12:06 kpentchev

Curiously, the following statement works just fine:

<ul data-repeat="${annotations.get(item).keySet().toArray()}" data-var="item2" data-rendered="${annotations.hasNext(item)}">

kpentchev avatar Jun 11 '12 12:06 kpentchev