Added some NULL checks in passwordstore.c to avoid potential crash.