libostree: Add an assert to pacify clang-analyzer

Got this error when trying to rebase libostree in RHEL:

```
Error: CLANG_WARNING: [#def1]
libostree-2019.2/src/libostree/ostree-repo-checkout.c:375:21: warning: Access to field 'disable_xattrs' results in a dereference of a null pointer (loaded from variable 'repo')
```

I think what's happening is it sees us effectively testing
`if (repo == NULL)` via the `while (current_repo)`.  Let's
tell it we're sure it's non-null right after the loop.
This commit is contained in:
Colin Walters 2019-10-14 13:25:46 +00:00
parent aefa1ca249
commit aa7795d08d
1 changed files with 2 additions and 0 deletions

View File

@ -717,6 +717,8 @@ checkout_one_file_at (OstreeRepo *repo,
}
current_repo = current_repo->parent_repo;
}
/* Pacify clang-analyzer which sees us testing effectively if (repo == NULL) */
g_assert (repo);
need_copy = (hardlink_res == HARDLINK_RESULT_NOT_SUPPORTED);
}