The onClick listener doesn't seem to function, for whatever reason, and the -1 index was leading to an invalid array lookup. So I moved the log-out action into a check for array validity.