From 8c3981867071ec453b2a219ae68d7b341bb62472 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 8 Jan 2015 16:05:38 -0800 Subject: [PATCH] Don't blow up when asking for schema at non-existent path --- spec/config-spec.coffee | 3 +++ src/config.coffee | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 19026abd6..c60b88e24 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -1060,6 +1060,9 @@ describe "Config", -> type: 'integer' default: 12 + expect(atom.config.getSchema('foo.baz')).toBeUndefined() + expect(atom.config.getSchema('foo.bar.anInt.baz')).toBeUndefined() + it "respects the schema for scoped settings", -> schema = type: 'string' diff --git a/src/config.coffee b/src/config.coffee index 9d51b907d..17c697930 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -703,7 +703,7 @@ class Config schema = @schema for key in keys break unless schema? - schema = schema.properties[key] + schema = schema.properties?[key] schema # Deprecated: Returns a new {Object} containing all of the global settings and