From 49aebe2fbab7852ec0c184d6554503d870405b0d Mon Sep 17 00:00:00 2001 From: Julia Aranovich Date: Thu, 8 Dec 2016 16:47:18 +0300 Subject: [PATCH] Handle setting with undefined weight Related-Bug: #1644461 Change-Id: I49fa28eb9aed96ec7aeed01d9d4d65363fe89d88 (cherry picked from commit 412f9a29cb895be6466f69bd32d0791f2e91b725) --- static/models.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/models.js b/static/models.js index 0dd6d6160..1e473deae 100644 --- a/static/models.js +++ b/static/models.js @@ -954,7 +954,9 @@ models.Settings = BaseModel this.isValid({models}); }, sortAttributes({weight: weight1, label: label1}, {weight: weight2, label: label2}) { - if (weight1 !== weight2) return weight1 - weight2; + if (weight1 !== weight2 && (weight1 || weight2)) { + return (weight1 && weight2) ? weight1 - weight2 : weight1 ? -1 : 1; + } return utils.natsort(label1, label2); } });