Set metadata to empty hash when missing

This commit is contained in:
Kevin Sawicki 2013-02-06 18:10:18 -08:00 committed by Corey Johnson & Kevin Sawicki
parent cd56d0a1d2
commit 856b378f54

View File

@ -24,9 +24,10 @@ class AtomPackage extends Package
loadMetadata: ->
if metadataPath = fs.resolveExtension(fs.join(@path, "package"), ['cson', 'json'])
@metadata = fs.readObject(metadataPath)
@metadata ?= {}
loadKeymaps: ->
if keymaps = @metadata?.keymaps
if keymaps = @metadata.keymaps
keymaps = keymaps.map (relativePath) =>
fs.resolve(@keymapsDirPath, relativePath, ['cson', 'json', ''])
keymap.load(keymapPath) for keymapPath in keymaps