NXP-14009: fix possible NPE when doc is null