summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-02-01 09:41:16 +0000
committerGitHub <noreply@github.com>2021-02-01 09:41:16 +0000
commit41ccbc048ce867a2bb23b077655b7a5d36b66ec4 (patch)
tree264e995779abfa7986803b7e5529879563a509d0
parent50f536222b6576a4204b980978d6094770a21038 (diff)
parent2f382ab74b7b8568b47e118f1802763a911b84e3 (diff)
downloadlibgit2-41ccbc048ce867a2bb23b077655b7a5d36b66ec4.tar.gz
Merge pull request #5783 from lhchavez/mwindow-coverity
mwindow: Fix a bug in the LRU window finding code
-rw-r--r--src/mwindow.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mwindow.c b/src/mwindow.c
index 7832d9c8b..5fcae2eed 100644
--- a/src/mwindow.c
+++ b/src/mwindow.c
@@ -312,8 +312,10 @@ static int git_mwindow_find_lru_file_locked(git_mwindow_file **out)
current_file, &mru_window, NULL, true, GIT_MWINDOW__MRU)) {
continue;
}
- if (!lru_window || lru_window->last_used > mru_window->last_used)
+ if (!lru_window || lru_window->last_used > mru_window->last_used) {
+ lru_window = mru_window;
lru_file = current_file;
+ }
}
if (!lru_file) {