Repository: frappe/frappe
Pull request: fix(base_list): Verify that filters are not undefined/empty. #9468
Fixes an issue with empty filters in certain list views as referenced in #9467

## Explain the **details** for making this change. What existing problem does the pull request solve?
Certain lists in ERPNext reports create issues due to an insufficient handling of not defined or empty filters. 

## Screenshots/GIFs
<img width="802" alt="Screenshot 2020-02-14 at 14 56 03" src="https://user-images.githubusercontent.com/579379/74673919-84a94080-51b0-11ea-9949-ac6d3866e78c.png">

closes #9467 


Problem statement:
setup filter area in base_list.js creates error on custom reports in erpnext due to missing argument
## Description of the issue
following lines in base_list.js create an error on certain lists created in ERPNext
```
	setup_filter_area() {
		this.filter_area = new FilterArea(this);

		if (this.filters.length > 0) {
			return this.filter_area.set(this.filters);
		}
	}
```
Console Error
base_list.js:233 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
    at frappe.views.ReportView.setup_filter_area (base_list.js:233)

Seems someone forgot to verify that filters was not undefined/empty.

## Context information (for bug reports)
Bench Version 4.1.0

## Steps to reproduce the issue
It is unclear to us why this reason appears only on some reports
### Observed result
List doesn't load 
and gives console error 
```
base_list.js:233 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
    at frappe.views.ReportView.setup_filter_area (base_list.js:233)
```

### Expected result
List loads


## Additional information
Ubuntu 16.04 LTS

Hints from issue discussion:

Commit message: fix(base_list): Verify that filters are not undefined/empty. #9468

Fixes an issue with empty filters in certain list views as referenced in #9467

Patch to review:
diff --git a/frappe/public/js/frappe/list/base_list.js b/frappe/public/js/frappe/list/base_list.js
index cbd0b1954caf..2ed6fa1ba0b3 100644
--- a/frappe/public/js/frappe/list/base_list.js
+++ b/frappe/public/js/frappe/list/base_list.js
@@ -230,7 +230,7 @@ frappe.views.BaseList = class BaseList {
 	setup_filter_area() {
 		this.filter_area = new FilterArea(this);
 
-		if (this.filters.length > 0) {
+		if(this.filters && this.filters.length > 0) {
 			return this.filter_area.set(this.filters);
 		}
 	}


Code review comments:
diff_hunk: @@ -230,7 +230,7 @@ frappe.views.BaseList = class BaseList {
 	setup_filter_area() {
 		this.filter_area = new FilterArea(this);
 
-		if (this.filters.length > 0) {
+		if(this.filters && this.filters.length > 0) {
path: frappe/public/js/frappe/list/base_list.js
text: @user1:
```suggestion
		if (this.filters && this.filters.length > 0) {
```