Commit a1f29c05 authored by mengcuiguang's avatar mengcuiguang

优化空指针

parent 74768dd7
......@@ -70,7 +70,7 @@ object BannerManager {
if (it.size > 0) {
val ad: TTNativeExpressAd = it[0]
bannerAd = ad
if (bannerAd != null) {
if (bannerAd != null && bannerAd!!.mediationManager != null && bannerAd!!.mediationManager.showEcpm != null) {
val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE3
vo["ecpm"] = bannerAd!!.mediationManager.showEcpm.ecpm
......
......@@ -14,6 +14,7 @@ import com.bytedance.sdk.openadsdk.mediation.ad.MediationViewBinder
import com.duben.speedplayletu.MintsApplication
import com.duben.speedplayletu.R
import com.duben.speedplayletu.ad.AdManager
import com.duben.speedplayletu.ad.banner.BannerManager
import com.duben.speedplayletu.common.Constant
import com.duben.speedplayletu.manager.TrackManager
import com.duben.speedplayletu.utils.ForegroundOrBackground
......@@ -118,11 +119,13 @@ class ExpressManager {
private fun showAd() {
mTTFeedAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val ecpm = it.mediationManager.showEcpm.ecpm
val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["ecpm"] = ecpm
TrackManager.getInstance().cmtEcpm(vo)
}
if (it.mediationManager.isExpress) {
//--------------信息流模板广告渲染----------------
showExpressView(it)
......
......@@ -79,11 +79,13 @@ class MainExpressManager {
expressAdCallback: ExpressAdCallback
) {
ttNativeAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val ecpm = it.mediationManager.showEcpm.ecpm
val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["ecpm"] = ecpm
TrackManager.getInstance().cmtEcpm(vo)
}
if (it.mediationManager.isExpress) {
//--------------信息流模板广告渲染----------------
showExpressView(it, expressAdCallback)
......
......@@ -118,11 +118,13 @@ class MyExpressManager {
private fun showAd() {
mTTFeedAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val ecpm = it.mediationManager.showEcpm.ecpm
val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["ecpm"] = ecpm
TrackManager.getInstance().cmtEcpm(vo)
}
if (it.mediationManager.isExpress) {
//--------------信息流模板广告渲染----------------
showExpressView(it)
......
......@@ -162,9 +162,9 @@ object SplashManager {
isShowAd = true
LogUtil.d(TAG, "gromore 开屏广告--> 6、onAdShow ")
if (mTTSplashAd != null) {
val vo = HashMap<String, Any>()
mTTSplashAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val vo = HashMap<String, Any>()
vo["ecpm"] = it.mediationManager.showEcpm.ecpm
vo["adType"] = Constant.GRO_MORE_ADTYPE0
TrackManager.getInstance().cmtEcpm(vo)
......
......@@ -189,7 +189,7 @@ public class InMoneyVideo {
@Override
public void onAdShow() {
if (mttRewardAd != null) {
if (mttRewardAd.getMediationManager().getShowEcpm() != null) {
if (mttRewardAd.getMediationManager() != null && mttRewardAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName();
......@@ -218,7 +218,7 @@ public class InMoneyVideo {
int adCount = AppPreferencesManager.INSTANCE.get().getInt(Constant.VEDIO_AD_COUNT, 0);
if (adCount < 50) {
AppPreferencesManager.INSTANCE.get().put(Constant.VEDIO_AD_COUNT, adCount+1);
AppPreferencesManager.INSTANCE.get().put(Constant.VEDIO_AD_COUNT, adCount + 1);
}
HashMap<String, Object> vo = new HashMap<>();
......
......@@ -128,7 +128,7 @@ public class InMoneyVideoNoPre {
}
if (mttRewardAd != null) {
if (mttRewardAd.getMediationManager().getShowEcpm() != null) {
if (mttRewardAd.getMediationManager() != null && mttRewardAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment