how to fix connectionManager.activeNetworkInfo must not be null ? using kotlin
i'm trying to check the connectivity and do some actions in each state but when i turn of the connection in my mobile the app crash and it give me this error 'cnxManager .activeNetworkInfo must not be null'
My code
private fun isConnected(webView: WebView){
val cnxManager : ConnectivityManager = baseContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val netInfo : NetworkInfo = cnxManager.activeNetworkInfo
if (netInfo.isConnected &&...