raft: Avoid null dereference in raft_update_our_match_index().
When the server is leaving the cluster but remains leader, the
raft_find_server() call can return NULL.  Previously this caused a null
dereference.  This commit fixes the problem.
Acked-by: Mark Michelson
@@ -3045,8 +3045,10 @@ raft_update_match_index(struct raft *raft, struct raft_server *s,
static void
raft_update_our_match_index(struct raft *raft, uint64_t min_index)
{
- raft_update_match_index(raft, raft_find_server(raft, &raft->sid),
- min_index);
+ struct raft_server *server = raft_find_server(raft, &raft->sid);
+ if (server) {
+ raft_update_match_index(raft, server, min_index);
+ }
}
static void
