off by one: show chats cnt-1..0 instead of cnt-1..1

This commit is contained in:
B. Petersen
2019-08-12 01:28:36 +02:00
parent ce3b815bd8
commit adb67d1910

View File

@@ -606,7 +606,6 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
let listflags = if arg0 == "listarchived" { 0x01 } else { 0 };
let chatlist = Chatlist::try_load(context, listflags, Some(arg1), None)?;
let mut i: usize;
let cnt = chatlist.len();
if cnt > 0 {
info!(
@@ -614,9 +613,7 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
"================================================================================"
);
i = cnt - 1;
while i > 0 {
for i in (0..cnt).rev() {
let chat = dc_get_chat(context, chatlist.get_chat_id(i));
let temp_subtitle = dc_chat_get_subtitle(chat);
let temp_name = dc_chat_get_name(chat);
@@ -670,8 +667,6 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
context, 0,
"================================================================================"
);
i -= 1
}
}
if dc_is_sending_locations_to_chat(context, 0 as uint32_t) {