pengwei1024 / JsBridge

A simpler, extendable bidirectional communication Frame between Android WebView and Javascript
https://github.com/pengwei1024/JsBridge/wiki
Apache License 2.0
643 stars 88 forks source link

Caused by: java.lang.NullPointerException #9

Closed tv009 closed 7 years ago

tv009 commented 7 years ago

Caused by: java.lang.NullPointerException at com.apkfuns.jsbridge.module.b.getBoolean(JBMapImpl.java:42) at com.apkfuns.jsbridge.module.WritableJBMap$Create.getBoolean(WritableJBMap.java:28) at com.master.kr.com.apkfuns.jsbridgesample.module.ServiceModule.ajax(ServiceModule.java:75)

dataMap.getBoolean(name) 实现方法有问题!

    dataMap.getBoolean("aa");  ----> NullPointerException
    dataMap.getDouble("bb");  ----> NullPointerException
    dataMap.getInt("int");  ----> NullPointerException
    dataMap.getLong("aaa");  ----> NullPointerException
    dataMap.getJBArray("bbb");---->ok
    getString(  )   ---->ok
    其他GET方法都正常  有空指针的都在上面

简单说 以上发生空指针的都是 没有set对应值时发生的 应该在GET时 赋予默认值 或NULL 并不应该发生异常!

pengwei1024 commented 7 years ago

多谢反馈,会尽快修复这个问题

pengwei1024 commented 7 years ago

@tv009 v2.1.1 版本已经修复,欢迎试用

tv009 commented 7 years ago

OK!