The top-level function already returns a boolean, make many of the internal functions return false in case of failure and propagate that instead of asserting in debug builds and continuing with bad input in release builds. Change-Id: I00c5f9552eb114af1f406f5f1c2ead50fe6b97e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201228 Tested-by: Jenkins Reviewed-by: Khaled Hosny <khaled@libreoffice.org>