Describe the bug
https://github.com/nextcloud/text/blob/master/lib/Service/DocumentService.php#L376 expects a session.
https://github.com/nextcloud/text/blob/master/lib/Service/ApiService.php#L141-L142 might call it without one if the session cannot be found.
Either prevent this by checking for a valid session first like the sync function does or handle the case that getSession returns false.