Fix #26 by checking for invalid data before attempting access.