From c8f134370bf1bbbf78c630f60d32fde09a51cdd0 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Mon, 3 Feb 2014 10:34:52 -0500 Subject: [PATCH] Provide a valid local id when a fresh database with no messages is used (imported from commit dafff9d4800a643693b57e92b7a02171c466333b) --- static/js/echo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/echo.js b/static/js/echo.js index c3490bac3a..522a32b1ca 100644 --- a/static/js/echo.js +++ b/static/js/echo.js @@ -118,7 +118,7 @@ function get_next_local_id() { if (typeof all_msg_list !== 'undefined' && all_msg_list.last() !== undefined) { latest = all_msg_list.last().id; } - return truncate_precision(latest + local_id_increment); + return Math.max(0, truncate_precision(latest + local_id_increment)); } function insert_local_message(message_request, local_id) {