fix 3 test panics: return (*C.char)(nil) for empty slice

Prevent panics in three tests by returning a null pointer for empty slices.