Skip to content

Commit

Permalink
fix: catch empty proto_map
Browse files Browse the repository at this point in the history
  • Loading branch information
Sieboldianus committed Sep 19, 2019
1 parent 0bd58aa commit 23559d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lbsntransform/classes/helper_functions.py
Expand Up @@ -462,8 +462,10 @@ def is_composite_field_container(in_obj):
def map_to_dict(proto_map):
"""Converts protobuf field map (ScalarMapContainer)
to Dictionary"""
mapped_dict = dict(zip(proto_map.keys(), proto_map.values()))
return mapped_dict
if proto_map:
mapped_dict = dict(zip(proto_map.keys(), proto_map.values()))
return mapped_dict
return {}

@staticmethod
def merge_existing_records(oldrecord, newrecord):
Expand All @@ -484,7 +486,7 @@ def load_importer_mapping_module(origin: int):
"""
if origin == 2:
from .field_mapping_flickr import FieldMappingFlickr as importer
if origin == 21:
elif origin == 21:
# Flickr YFCC100M dataset
from .field_mapping_yfcc100m import FieldMappingYFCC100M as importer
elif origin == 3:
Expand Down

0 comments on commit 23559d5

Please sign in to comment.