add comment about possible error.
Improve performance a bit by removing strlen(str) > 0.