commit 3e6e13b22e6744ac9ba40feadac972d441b7e6c5 from: Stefan Sperling via: Thomas Adam date: Tue Oct 01 23:00:28 2024 UTC prevent tog segfault upon unexpected object type in ref list view If an unexpected object type is found while resolving a reference in the ref view, have tog exit with an "unknown object type" error instead of crashing. Found while playing with a repo which contains tags that tag tags. commit - 856eeb981b56bc60553350302b84c28a7dceadf7 commit + 3e6e13b22e6744ac9ba40feadac972d441b7e6c5 blob - 13f2d65c61250938cebab41b76af0fbad0d322c7 blob + 35e506fa81a4f1d159e47643c3af493dc71e737c --- tog/tog.c +++ tog/tog.c @@ -8756,12 +8756,8 @@ log_ref_entry(struct tog_view **new_view, int begin_y, *new_view = NULL; err = resolve_reflist_entry(&commit_id, re, repo); - if (err) { - if (err->code != GOT_ERR_OBJ_TYPE) - return err; - else - return NULL; - } + if (err) + return err; log_view = view_open(0, 0, begin_y, begin_x, TOG_VIEW_LOG); if (log_view == NULL) { @@ -9083,13 +9079,8 @@ browse_ref_tree(struct tog_view **new_view, int begin_ *new_view = NULL; err = resolve_reflist_entry(&commit_id, re, repo); - if (err) { - if (err->code != GOT_ERR_OBJ_TYPE) - return err; - else - return NULL; - } - + if (err) + return err; tree_view = view_open(0, 0, begin_y, begin_x, TOG_VIEW_TREE); if (tree_view == NULL) {