shared: Fix null pointer deref in my_strtok

If my_strtok was supplied with a NULL buffer on the first call,
it would (needlessly) trigger a null pointer dereference. This patch
adds a check for that case and a test case that triggers the error
without the patch applied.

Signed-off-by: Anton Lofgren <alofgren@op5.com>