nitc/abscomp: add helper function maybenull to factorize code