mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 14:39:34 +01:00
core: add null sanity checks in migration
This commit is contained in:
@@ -63,6 +63,8 @@ export const migrations = {
|
|||||||
5.5: {},
|
5.5: {},
|
||||||
5.6: {
|
5.6: {
|
||||||
notebook: (item) => {
|
notebook: (item) => {
|
||||||
|
if (!item.topics) return item;
|
||||||
|
|
||||||
item.topics = item.topics.map((topic) => {
|
item.topics = item.topics.map((topic) => {
|
||||||
delete topic.notes;
|
delete topic.notes;
|
||||||
return topic;
|
return topic;
|
||||||
@@ -70,7 +72,11 @@ export const migrations = {
|
|||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
settings: async (item, db) => {
|
settings: async (item, db) => {
|
||||||
|
if (!item.pins) return item;
|
||||||
|
|
||||||
for (const pin of item.pins) {
|
for (const pin of item.pins) {
|
||||||
|
if (!pin.data) continue;
|
||||||
|
|
||||||
await db.shortcuts.add({
|
await db.shortcuts.add({
|
||||||
item: {
|
item: {
|
||||||
type: pin.type,
|
type: pin.type,
|
||||||
|
|||||||
Reference in New Issue
Block a user