Get next local id correctly when all message list is empty

(imported from commit 07208222ea682251927ef13c684e9e89277233bf)
This commit is contained in:
Leo Franchi 2014-01-30 16:16:40 -05:00
parent 01e948ac97
commit 2fac412119
1 changed files with 1 additions and 1 deletions

View File

@ -115,7 +115,7 @@ exports._add_message_flags = add_message_flags;
function get_next_local_id() { function get_next_local_id() {
var local_id_increment = 0.01; var local_id_increment = 0.01;
var latest = page_params.max_message_id; var latest = page_params.max_message_id;
if (typeof all_msg_list !== 'undefined') { if (typeof all_msg_list !== 'undefined' && all_msg_list.last() !== undefined) {
latest = all_msg_list.last().id; latest = all_msg_list.last().id;
} }
return truncate_precision(latest + local_id_increment); return truncate_precision(latest + local_id_increment);