修复GoogleFragment.java的url为空导致在输出日志时导致的空指针闪退问题

This commit is contained in:
zlzw 2023-01-13 09:46:06 +08:00
parent df436bbe1e
commit e932238fc2

View File

@ -24,6 +24,7 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.GoogleBillingUtilNew; import com.yunbao.common.utils.GoogleBillingUtilNew;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.views.TestWebViewClient; import com.yunbao.main.views.TestWebViewClient;
@ -55,6 +56,10 @@ public class GoogleFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//通过参数中的布局填充获取对应布局 //通过参数中的布局填充获取对应布局
view = inflater.inflate(R.layout.activity_recharge, container, false); view = inflater.inflate(R.layout.activity_recharge, container, false);
if(StringUtil.isEmpty(url)){
Log.e(TAG, "URL为空" );
return view;
}
rlWebview = (WebView) view.findViewById(R.id.rlWebview); rlWebview = (WebView) view.findViewById(R.id.rlWebview);
Log.e("ttt", url); Log.e("ttt", url);
rlWebview.loadUrl(url); rlWebview.loadUrl(url);