fixed ajaxlist bug

If a "string" or "action" is null, the table for the index will
not be generated because we cannot find the length of null, when
we are checking whether to shorten the text ( > 160 - shorten text)
This was found in the course index when two of the courses did not
have a creator id, which causes the text for the name to be null.
I have fixed this by also checking that the string is not null
before checking whether the string's length is greater than 160.