From fd7b3e0803124d42cc00f87f3a0b123a3f843d76 Mon Sep 17 00:00:00 2001 From: Juan Manuel Ventura Date: Fri, 22 Aug 2014 01:18:36 +0200 Subject: [PATCH] check store nullity in m.prop --- mithril.js | 2 +- tests/mithril-tests.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index 1ce8d2e9..f8506cba 100644 --- a/mithril.js +++ b/mithril.js @@ -393,7 +393,7 @@ Mithril = m = new function app(window, undefined) { } m.prop = function (store) { - if ((typeof store === 'object' || typeof store === 'function') && + if ((typeof store === 'object' || typeof store === 'function') && store !== null && typeof store.then === 'function') { var prop = _prop() newPromisedProp(prop, store).then(prop) diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index 98fc77a0..f8f7e5ba 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -1508,6 +1508,10 @@ function testMithril(mock) { return prop() === "test2" }) + test(function() { + var prop = m.prop(null) + return prop() === null + }) //m.request test(function() {