Build crashed on an empty docstring. Fixed.

If an empty docstring was encountered, build would crash with IndexError (```result``` was empty, so accessing its -1st element raised an error).

Additional checks added.