Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Add safety around skillMetadata
Browse files Browse the repository at this point in the history
skillMetadata could be accessed in settings without it when checking if remote update was needed.
  • Loading branch information
forslund committed Apr 24, 2019
1 parent a5f44d9 commit aa6dee6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mycroft/skills/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ def save_skill_settings(self, skill_settings):
Args:
skill_settings (dict): skill
"""
self._save_uuid(skill_settings['uuid'])
if 'uuid' in skill_settings:
self._save_uuid(skill_settings['uuid'])
if 'skillMetadata' in skill_settings:
sections = skill_settings['skillMetadata']['sections']
for section in sections:
Expand Down Expand Up @@ -606,7 +607,8 @@ def _delete_metadata(self, uuid):
@property
def _should_upload_from_change(self):
changed = False
if hasattr(self, '_remote_settings'):
if (hasattr(self, '_remote_settings') and
'skillMetadata' in self._remote_settings):
sections = self._remote_settings['skillMetadata']['sections']
for i, section in enumerate(sections):
for j, field in enumerate(section['fields']):
Expand Down

0 comments on commit aa6dee6

Please sign in to comment.