This reverts commit 6a1a4880f0.
6a1a4880f0
This checks if the offset exists before accessing it and also adds unit tests to this function which would have catched this before 🙈 Fixes https://github.com/owncloud/core/issues/14277