workaround for occasional nil cstring crash

I was seeing an occasional crash here, because the cstring is nil. This is a quick workaround to prevent the crash.