Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
fix NoSuchMethodError in filter
Browse files Browse the repository at this point in the history
I got errors when using `filter` for objects that is nullable.
I seem to be no substantial problem.
However, I want to suppress unwanted errors.

```
The null object does not have a method 'toList'.

NoSuchMethodError: method not found: 'toList'
Receiver: null
Arguments: [growable: false]

STACKTRACE:
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1      Filter.call (package:angular/formatter/filter.dart:193:26)
...
```
  • Loading branch information
michilu committed Mar 9, 2015
1 parent f9406a4 commit 4614e93
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/formatter/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ class Filter implements Function {
}

List call(List items, var expression, [var comparator]) {
if (items == null) {
return const [];
}
if (expression == null) {
return items.toList(growable: false); // Missing expression → passthrough.
} else if (expression is! Map && expression is! Function &&
Expand Down

0 comments on commit 4614e93

Please sign in to comment.