summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2016-10-12 17:48:28 +0800
committerWu Cheng-Han2016-10-12 17:48:28 +0800
commit12b7646f247f2325c8d4593480571868b0783612 (patch)
tree86632bf43f0355c4914d2c0347d7dcaac1644540
parentbd6d69d7a70451a9a587c9ee54b6025d1b27f4ce (diff)
Fix to handle name or color might get undefined error
-rw-r--r--public/js/index.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 30d9e4e1..06be2f77 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2792,14 +2792,14 @@ function sortOnlineUserList(list) {
else if (usera.idle && !userb.idle)
return 1;
else {
- if (usera.name.toLowerCase() < userb.name.toLowerCase()) {
+ if (usera.name && usera.name.toLowerCase() < userb.name.toLowerCase()) {
return -1;
- } else if (usera.name.toLowerCase() > userb.name.toLowerCase()) {
+ } else if (usera.name && usera.name.toLowerCase() > userb.name.toLowerCase()) {
return 1;
} else {
- if (usera.color.toLowerCase() < userb.color.toLowerCase())
+ if (usera.color && usera.color.toLowerCase() < userb.color.toLowerCase())
return -1;
- else if (usera.color.toLowerCase() > userb.color.toLowerCase())
+ else if (usera.color && usera.color.toLowerCase() > userb.color.toLowerCase())
return 1;
else
return 0;