Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: pkg/polymer_expressions/lib/eval.dart

Issue 314583004: Silently fail when assigning to properties on null (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/polymer_expressions/test/eval_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer_expressions/lib/eval.dart
diff --git a/pkg/polymer_expressions/lib/eval.dart b/pkg/polymer_expressions/lib/eval.dart
index ba7b651ce24ee1ab4f819e70372e56829fa16bc4..2af7d543ff5cc8ca282af2fd89df28ea441ca9d3 100644
--- a/pkg/polymer_expressions/lib/eval.dart
+++ b/pkg/polymer_expressions/lib/eval.dart
@@ -134,7 +134,10 @@ Object assign(Expression expr, Object value, Scope scope) {
}
// make the assignment
var o = eval(expression, scope);
- if (o == null) throw new EvalException("Can't assign to null: $expression");
+
+ // can't assign to a property on a null LHS object. Silently fail.
+ if (o == null) return null;
+
if (isIndex) {
o[property] = value;
} else {
« no previous file with comments | « no previous file | pkg/polymer_expressions/test/eval_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698