Avoid NPE in query cache