Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd8d539

Browse files
author
梁登科
committed
fix PI-8768
1 parent 3dbb8c4 commit dd8d539

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎android/src/main/java/com/growingio/plugin/fluttergrowingiotrack/FlutterGrowingIOTrackPlugin.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package com.growingio.plugin.fluttergrowingiotrack;
22

3+
import android.text.TextUtils;
4+
5+
import com.growingio.android.sdk.collection.ErrorLog;
36
import com.growingio.android.sdk.collection.GrowingIO;
7+
import com.growingio.android.sdk.utils.LogUtil;
48
import com.growingio.android.sdk.utils.ThreadUtils;
59

610
import org.json.JSONException;
@@ -80,6 +84,7 @@ private void onTrack(MethodCall call){
8084
GrowingIO gio = GrowingIO.getInstance();
8185
if (call.hasArgument("variable")){
8286
JSONObject variable = toJson(call.argument("variable"));
87+
if (variable == null) return;
8388
if (hasNum){
8489
gio.track(eventId, num, variable);
8590
}else{
@@ -108,6 +113,10 @@ private JSONObject mapToJson(Map<String, Object> map){
108113
JSONObject jsonObject = new JSONObject();
109114
for (String key: map.keySet()){
110115
try {
116+
if (TextUtils.isEmpty(key)){
117+
LogUtil.e("GrowingIO", ErrorLog.EVENT_NAME_ILLEGAL);
118+
return null;
119+
}
111120
jsonObject.put(key, map.get(key));
112121
} catch (JSONException e) {
113122
e.printStackTrace();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /