diff options
author | Wu Cheng-Han | 2017-01-12 17:17:36 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2017-01-12 17:17:36 +0800 |
commit | ffa14cfeefb9afcc6f177a9ecfe710ffb3227242 (patch) | |
tree | 85b59d2040e606565c99923d68eab1576cb02442 /public | |
parent | fc788e805e8896f3ae967270148939d37923c516 (diff) |
Fix sortOnlineUserList might not check property existence before comparsion
Diffstat (limited to 'public')
-rw-r--r-- | public/js/index.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/public/js/index.js b/public/js/index.js index 91dc8f0d..7effcbd7 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2946,14 +2946,14 @@ function sortOnlineUserList(list) { else if (usera.idle && !userb.idle) return 1; else { - if (usera.name && usera.name.toLowerCase() < userb.name.toLowerCase()) { + if (usera.name && userb.name && usera.name.toLowerCase() < userb.name.toLowerCase()) { return -1; - } else if (usera.name && usera.name.toLowerCase() > userb.name.toLowerCase()) { + } else if (usera.name && userb.name && usera.name.toLowerCase() > userb.name.toLowerCase()) { return 1; } else { - if (usera.color && usera.color.toLowerCase() < userb.color.toLowerCase()) + if (usera.color && userb.color && usera.color.toLowerCase() < userb.color.toLowerCase()) return -1; - else if (usera.color && usera.color.toLowerCase() > userb.color.toLowerCase()) + else if (usera.color && userb.color && usera.color.toLowerCase() > userb.color.toLowerCase()) return 1; else return 0; |