Merge pull request #5783 from lhchavez/mwindow-coverity mwindow: Fix a bug in the LRU window finding code
diff --git a/src/mwindow.c b/src/mwindow.c
index 7832d9c..5fcae2e 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) {