avoid segfault when invalid buffer passed
typo
Merge pull request #1 from ghanto/master

avoid segfault when invalid buffer passed