Skip to content

Commit 3b76c49

Browse files
author
River
committed
fix crash bug
1 parent ae2fd23 commit 3b76c49

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/org/qpython/sample/MainActivity.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ public void onQPyExec(View v) {
9191
@Override
9292
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
9393
if (requestCode == SCRIPT_EXEC_PY) {
94-
Bundle bundle = data.getExtras();
95-
String flag = bundle.getString("flag"); // flag you set
96-
String param = bundle.getString("param"); // param you set
97-
String result = bundle.getString("result"); // Result your Pycode generate
98-
Toast.makeText(this, "onQPyExec: return ("+result+")", Toast.LENGTH_SHORT).show();
94+
if (data!=null) {
95+
Bundle bundle = data.getExtras();
96+
String flag = bundle.getString("flag"); // flag you set
97+
String param = bundle.getString("param"); // param you set
98+
String result = bundle.getString("result"); // Result your Pycode generate
99+
Toast.makeText(this, "onQPyExec: return ("+result+")", Toast.LENGTH_SHORT).show();
100+
} else {
101+
Toast.makeText(this, "onQPyExec: data is null", Toast.LENGTH_SHORT).show();
102+
103+
}
99104
}
100105
}
101106

0 commit comments

Comments
 (0)