Provide a valid local id when a fresh database with no messages is used

(imported from commit dafff9d4800a643693b57e92b7a02171c466333b)
This commit is contained in:
Leo Franchi
2014-02-03 10:34:52 -05:00
parent bb0784d9aa
commit c8f134370b

View File

@@ -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) {