diff --git a/CHANGELOG.md b/CHANGELOG.md index ff7f1690..28346b25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed +- Crash when the delta link is expired + ## [1.1.1] - 2018-01-20 ### Fixed - Wrong regex for parsing authentication uri diff --git a/src/sync.d b/src/sync.d index 7e0a59ce..775a7ba0 100644 --- a/src/sync.d +++ b/src/sync.d @@ -160,7 +160,7 @@ final class SyncEngine JSONValue changes; string deltaLink = itemdb.getDeltaLink(driveId, id); log.vlog("Applying changes of " ~ id); - do { + for (;;) { try { changes = onedrive.viewChangesById(driveId, id, deltaLink); } catch (OneDriveException e) { @@ -181,7 +181,8 @@ final class SyncEngine if ("@odata.deltaLink" in changes) deltaLink = changes["@odata.deltaLink"].str; if (deltaLink) itemdb.setDeltaLink(driveId, id, deltaLink); if ("@odata.nextLink" in changes) deltaLink = changes["@odata.nextLink"].str; - } while ("@odata.nextLink" in changes); + else break; + } // delete items in idsToDelete if (idsToDelete.length > 0) deleteItems();