Permalink
Browse files

[fix] Don't continue with the sorting if we don't have any attributes…

…. Eg a `map#tag`
  • Loading branch information...
1 parent e6c1802 commit 57674a58597d3b5835e37e4af7ebd3dd787c3ad6 @3rd-Eden 3rd-Eden committed Aug 27, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/plates.js
View
@@ -70,7 +70,11 @@ var Plates = (typeof module !== 'undefined' && typeof module.exports !== 'undefi
//
function compileMappings(oldMappings) {
var mappings = oldMappings.slice(0);
+
mappings.sort(function(map1, map2) {
+ if (!map1.attribute) return 1;
+ if (!map2.attribute) return -1;
+
if (map1.attribute !== map2.attribute) {
return map1.attribute < map2.attribute ? -1 : 1;
}

0 comments on commit 57674a5

Please sign in to comment.