Add check for when can't find parent ID and write to severe error log

This commit is contained in:
Hank Grabowski 2023-02-08 17:24:04 +01:00
parent 04fa5395d3
commit 5c0677b923

View file

@ -283,6 +283,11 @@ class EntryManagerService extends ChangeNotifier {
final parentParentPostId = _postNodes.containsKey(item.parentId)
? item.parentId
: _parentPostIds[item.parentId];
if (_postNodes[parentParentPostId] == null) {
_logger.severe(
'Error finding parent ${item.parentId} for entry ${item.id}');
continue;
}
final parentPostNode = _postNodes[parentParentPostId]!;
postNodesToReturn.add(parentPostNode);
_parentPostIds[item.id] = parentPostNode.id;