Fixes the crash mentioned in https://github.com/koreader/koreader/issues/9409#issuecomment-1207484444?