It is possible if white last move was to capture a piece on g7. Let us say a black pawn.Before the white bishop moved to g7 capturing the pawn, that pawn shielded the king from the white queen.