fix NPE when saveBudget and maxCode is null