TypeError this.a.b未定义

时间:2019-04-02 10:18:27

标签: javascript

我的kibana日志中出现错误,内容如下: SELECT DISTINCT company.company_id, company.companyname_1, customer.customer_id, customer.customername_1, DECODE(receipt.table_name, 'PAYMENT', SUM(COUNT(receipt.receipt_id))) as inpayment FROM company JOIN customer ON company.company_id = customer.company_id JOIN debtor ON customer.customer_id = debtor.customer_id JOIN debtortrunk ON debtor.debtor_id = debtortrunk.debtor_id JOIN receipt ON debtor.customer_id = receipt.customer_id AND debtor.deb_id = receipt.deb_id WHERE receipt.created >= '24.01.2018' AND receipt.created <= '28.01.2018' GROUP BY company.company_id, company.companyname_1, customer.customer_id, customer.customername_1 。我对措词感到有些困惑,因为我通常会在this.a.b is undefined中看到一个未定义的属性。

我使用此属性的唯一地方是为它分配一个值:cannot read property b of undefined-赋值可能是这种措辞的原因吗?

预先感谢

1 个答案:

答案 0 :(得分:0)

没有看到您的代码: 编写这样的nullguard:

if( this && this.a && this.a.b) { /*do stuff*/}

以此确保您要执行操作的元素在那里。