lib: Don't try to use a NULL FlatpakRemoteState
lib: Don't try to use a NULL FlatpakRemoteState

In flatpak_remote_ref_new(), the state parameter is optional, so check
if it's NULL before trying to use it in
flatpak_remote_state_lookup_sparse_cache(). This prevents a seg fault
when GNOME Software is installing a .flatpakref file.

Fixes https://github.com/flatpak/flatpak/issues/1632

Closes: #1635
Approved by: pwithnall

matthiasclasen/flatpak,matthiasclasen/flatpak,matthiasclasen/flatpak,flatpak/flatpak,matthiasclasen/flatpak,flatpak/flatpak,flatpak/flatpak,matthiasclasen/flatpak,flatpak/flatpak,flatpak/flatpak