You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "dajiaohuang (via GitHub)" <gi...@apache.org> on 2026/10/25 04:57:32 UTC

[PR] (android) skip connectivity updates without a WebView [cordova-plugin-network-information]

dajiaohuang opened a new pull request, #190:
URL: https://github.com/apache/cordova-plugin-network-information/pull/190

   ### Platforms affected
   
   Android
   
   ### Motivation and Context
   
   `registerConnectivityActionReceiver()` already accounts for an unavailable Cordova WebView, but previously guarded only `updateConnectionInfo()`. On Android M and later, if `lastTypeOfNetwork` is still null and `EXTRA_NO_CONNECTIVITY` is false or absent, the fallback continues to `sendUpdate(TYPE_UNKNOWN)`, which unconditionally calls `webView.postMessage(...)` and can throw a `NullPointerException`.
   
   Return early from the receiver when the WebView is unavailable so the fallback cannot reach that dereference. No matching existing issue was identified for this null-WebView crash path.
   
   ### Description
   
   Guard the complete connectivity-broadcast handling path against a null WebView. The fix is limited to Android and does not change how connection types are mapped.
   
   ### Testing
   
   - `npm test` passed (the package script runs `npm run lint`).
   - `git diff --check` passed.
   - Android emulator/Paramedic integration tests were not run; this work used no real device, network settings, or external connectivity.
   - No native Android unit-test harness is configured in this plugin; the failure path follows directly from the receiver's null check and the unguarded `sendUpdate()` call.
   
   ### Checklist
   
   - [x] I've run the tests to see all new and existing tests pass (`npm test`).
   - [x] Automated coverage was considered; this plugin has no configured native Android unit-test harness for this path.
   - [x] Commit is prefixed with `(android)`.
   - [x] No existing issue corresponds to this crash; the failure path is described above.
   - [x] Documentation changes are not necessary for this runtime guard.
   
   The implementation was generated in part with OpenAI Codex gpt-6-luna; commit provenance is recorded with a `Generated-by` trailer.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org