Anonymous avatar Anonymous committed d16b74a

fixed IndexError, check line dimensions in BreadcrumbsNode

Comments (0)

Files changed (1)

admintools_bootstrap/templatetags/admintools_bootstrap.py

         out = '<ul class="breadcrumb">'
         curr = 0
         for d in lines:
-            if d[0][0] == '*':
-                active = ' class="active"'
-                d[0] = d[0][1:]
-            else:
-                active = ''
+            if len(d[0]) > 0:
+                if d[0][0] == '*':
+                    active = ' class="active"'
+                    d[0] = d[0][1:]
+                else:
+                    active = ''
 
-            curr += 1
-            if (len(lines) == curr):
-                # last
-                divider = ''
-            else:
-                divider = '<span class="divider">/</span>'
+                curr += 1
+                if (len(lines) == curr):
+                    # last
+                    divider = ''
+                else:
+                    divider = '<span class="divider">/</span>'
 
-            if len(d) == 2:
-                out += '<li%s><a href="%s">%s</a>%s</li>' % (active, d[0], d[1], divider)
-            elif len(d) == 1:
-                out += '<li%s>%s%s</li>' % (active, d[0], divider)
-            else:
-                raise ValueError('Invalid breadcrumb line: %s' % self.delimiter.join(d))
+                if len(d) == 2:
+                    out += '<li%s><a href="%s">%s</a>%s</li>' % (active, d[0], d[1], divider)
+                elif len(d) == 1:
+                    out += '<li%s>%s%s</li>' % (active, d[0], divider)
+                else:
+                    raise ValueError('Invalid breadcrumb line: %s' % self.delimiter.join(d))
         out += '</ul>'
         return out
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.