From 45f0f36914bd1b869d9ad25fe74cb9df8e4a9945 Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Mon, 26 Feb 2018 09:38:03 +0100 Subject: [PATCH] fix($q): allow third-party promises For testing, it can be useful to run with other promise implementations like Bluebird.js + angular-bluebird-promises. This broke in angularjs 1.6 with a "TypeError: Cannot set property 'pur' of undefined". Closes #16164 --- src/ng/q.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ng/q.js b/src/ng/q.js index 3bfc61386295..a40ab4b680b1 100644 --- a/src/ng/q.js +++ b/src/ng/q.js @@ -677,10 +677,11 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) { } function isStateExceptionHandled(state) { + if (!state) return true; return !!state.pur; } function markQStateExceptionHandled(state) { - state.pur = true; + if (state) state.pur = true; } function markQExceptionHandled(q) { markQStateExceptionHandled(q.$$state);