shaqian / flutter_ssh

SSH and SFTP client for Flutter
https://pub.dartlang.org/packages/ssh
MIT License
117 stars 83 forks source link

App crashes on startup #1

Closed mevans closed 5 years ago

mevans commented 6 years ago

App crashes on startup with the error:

E/AndroidRuntime(19915): FATAL EXCEPTION: Thread-2 E/AndroidRuntime(19915): Process: xyz.mevans.ftpclient, PID: 19915 E/AndroidRuntime(19915): java.lang.NullPointerException: Attempt to read from field 'com.jcraft.jsch.Session sq.flutter.ssh.SshPlugin$SSHClient._session' on a null object reference E/AndroidRuntime(19915): at sq.flutter.ssh.SshPlugin$6.run(SshPlugin.java:278) E/AndroidRuntime(19915): at java.lang.Thread.run(Thread.java:764)

shaqian commented 6 years ago

Hi mevans,

Did you try to connect the client before connecting SFTP?

String result = await client.connect();
if (result == "session_connected") {
    result = await client.connectSFTP();
}

I will add logic in Android to check if client is null before getting session. (iOS already does this)

Thanks for reporting this.

mevans commented 6 years ago

Yeah I've already checked that by copying over a lot of the example project.

shaqian commented 6 years ago

Thanks for the reply.

I just published 0.0.2. Can you please test if your app still crashes with the new version? Also does the example project work as expected?

shaqian commented 5 years ago

Archiving the issue for now. Feel free to reopen if you have other questions.