Using MXFileStore in MXSession returns null pointer exception
sxz0 opened this issue · 1 comments
Hi,
i am using Matrix Android SDK, for start a MXSession i need an IMXStore object, if i use MXMemoryStore i dont have any trouble but if i use MXFileStore, when i start MXSession.startEventStream the log returns:
E/AndroidRuntime: FATAL EXCEPTION: Thread-8
Process: com.example.project, PID: 11020
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.matrix.androidsdk.util.MXOsHandler.post(java.lang.Runnable)' on a null object reference
at org.matrix.androidsdk.data.store.MXFileStore$9.run(MXFileStore.java:2209)
at java.lang.Thread.run(Thread.java:764)
I create the MXFileStore using the same HomeServerConnectionConfig that for the MXSession object, and using the application context:
(I previusly have the Credentials object)
HomeServerConnectionConfig hsConfig = new HomeServerConnectionConfig(Uri.parse("https://matrix.org"));
hsConfig.setCredentials(credentials);
IMXStore imxStore = new MXFileStore(hsConfig, appContext);
session = new MXSession(hsConfig, new MXDataHandler(imxStore, credentials), appContext);
I finally got a solution, during the first tests with the class, MXFileStore generated corrupted files, so after i delete these files it works properly