diff --git a/sidebar.c b/sidebar.c index 5a9cfcb..58ba56d 100755 --- a/sidebar.c +++ b/sidebar.c @@ -759,8 +759,12 @@ draw_sidebar (int first_row, int num_rows, int div_width) if (maildir_is_prefix && option (OPTSIDEBARFOLDERINDENT)) { const char *tmp_folder_name; int lastsep = 0; + size_t maxidx = 0; tmp_folder_name = b->path + maildirlen + 1; - for (i = 0; i < strlen (tmp_folder_name) - 1; i++) { + if (tmp_folder_name[0]) { + maxidx = strlen(tmp_folder_name) - 1; + } + for (i = 0; i < maxidx; i++) { if (SidebarDelimChars && strchr (SidebarDelimChars, tmp_folder_name[i])) { sidebar_folder_depth++;