commit 9c49c6c0edf6a702aa6b70f8327de7c53b2a42ad from: Stefan Sperling date: Fri Sep 27 13:52:45 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 - a158173067944ceae5091cd8ae47306e537641ea commit + 9c49c6c0edf6a702aa6b70f8327de7c53b2a42ad blob - 92c49a111e0129b584399ee632b0dd7882577ac5 blob + baee88c98e9574ccb82d6365b7fe0935c8cc6a72 --- tog/tog.c +++ tog/tog.c @@ -8752,12 +8752,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) { @@ -9079,13 +9075,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) {