You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
All: Better handling of null values in settings
This commit is contained in:
@@ -80,7 +80,17 @@ reg.scheduleSync = async (delay = null) => {
|
||||
|
||||
const contextKey = 'sync.' + syncTargetId + '.context';
|
||||
let context = Setting.value(contextKey);
|
||||
context = context ? JSON.parse(context) : {};
|
||||
try {
|
||||
context = context ? JSON.parse(context) : {};
|
||||
} catch (error) {
|
||||
// Clearing the context is inefficient since it means all items are going to be re-downloaded
|
||||
// however it won't result in duplicate items since the synchroniser is going to compare each
|
||||
// item to the current state.
|
||||
reg.logger().warn('Could not parse JSON sync context ' + contextKey + ':', context);
|
||||
reg.logger().info('Clearing context and starting from scratch');
|
||||
context = null;
|
||||
}
|
||||
|
||||
try {
|
||||
reg.logger().info('Starting scheduled sync');
|
||||
let newContext = await sync.start({ context: context });
|
||||
|
||||
Reference in New Issue
Block a user