[PATCH 3/5] taskschd: Add a check for null pointer in write_principal().