topology: fix potential null pointer from strchr