Skip to content

Commit

Permalink
if stashRef is invalid it should not checked further.
Browse files Browse the repository at this point in the history
Description: In a previous libgit2 version there was an assert and return if the stash is invalid, but in newer once it is not
  • Loading branch information
Murmele committed Jun 11, 2024
1 parent ebf2b60 commit 593d791
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ui/ReferenceModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ void ReferenceModel::update() {
// Add bottom references.
const bool stashOnCommit =
!mCommit.isValid() ||
mRepo.stashRef().annotatedCommit().commit() == mCommit;
(mRepo.stashRef().isValid() &&
mRepo.stashRef().annotatedCommit().commit() == mCommit);
if ((mKinds & ReferenceView::Stash) && stashOnCommit) {
if (git::Reference stash = mRepo.stashRef())
branches.append(stash);
Expand Down Expand Up @@ -180,8 +181,9 @@ QModelIndex ReferenceModel::firstBranch() {
// use the first valid ref after the invalid ref but only
// it is not the stash
if (ref.refs.count() > 1 &&
ref.refs.at(1).annotatedCommit().commit() !=
mRepo.stashRef().annotatedCommit().commit())
(!mRepo.stashRef().isValid() ||
ref.refs.at(1).annotatedCommit().commit() !=
mRepo.stashRef().annotatedCommit().commit()))
return createIndex(1, 0, ReferenceType::Branches);
} else if (ref.refs.count() > 0)
return createIndex(0, 0, ReferenceType::Branches);
Expand Down

0 comments on commit 593d791

Please sign in to comment.