diff --git a/like.py b/like.py index cc202681..b1441115 100644 --- a/like.py +++ b/like.py @@ -37,6 +37,8 @@ def undoLikesCollectionEntry(postFilename: str,objectUrl: str,actor: str,debug: return if not postJsonObject['object'].get('likes'): return + if not isinstance(postJsonObject['object']['likes'], dict): + return if not postJsonObject['object']['likes'].get('items'): return totalItems=0 @@ -81,6 +83,8 @@ def noOfLikes(postJsonObject: {}) -> int: return 0 if not postJsonObject['object'].get('likes'): return 0 + if not isinstance(postJsonObject['object']['likes'], dict): + return 0 if not postJsonObject['object']['likes'].get('items'): postJsonObject['object']['likes']['items']=[] postJsonObject['object']['likes']['totalItems']=0