Avoid dereferencing a null pointer when fetching grant references