Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminating app due to uncaught exception 'NSInvalidArgumentException' #22

Open
ceinem opened this issue Nov 30, 2019 · 6 comments · May be fixed by #24
Open

Terminating app due to uncaught exception 'NSInvalidArgumentException' #22

ceinem opened this issue Nov 30, 2019 · 6 comments · May be fixed by #24

Comments

@ceinem
Copy link

ceinem commented Nov 30, 2019

Im running into an error which sounds very similar to #4

2019-11-30 04:14:38.163 watoi[6690:431437] missing sender

2019-11-30 04:14:38.164 watoi[6690:431437] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unacceptable type of value for attribute: property = "memberJID"; desired type = NSString; given type = NSNull; value = .'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff341e49b3 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff6a369562 objc_exception_throw + 48
2 CoreData 0x00007fff33c66d72 _PFManagedObject_coerceValueForKeyWithDescription + 3234
3 CoreData 0x00007fff33c42868 _sharedIMPL_setvfk_core + 232
4 watoi 0x0000000108d8da24 -[Importer addMissingMember:toChat:asAdmin:] + 311
5 watoi 0x0000000108d8f51d -[Importer importMessages] + 1790
6 watoi 0x0000000108d8c9de main + 346
7 libdyld.dylib 0x00007fff6b6c02e5 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

I think it's just a NULL check missing, same as in #4 but I have absolutely no idea of objective C, so I am completely lost in trying to fix it myself.
Any change you can help me?

Thank a lot and keep up the great work!!

@ceinem
Copy link
Author

ceinem commented Nov 30, 2019

Ok, I dug into this for a couple of hours. I didn't manage to fix the bug itself, but as a workaround I just added a clause to skip all group chats. So I lost them, but all the rest seemed to work.

@Mc-muffin
Copy link

That fix in #4 was a simple null-check, this one should be the same, so try changing line 257 in main.m ([member setValue:memberJID forKey:@"memberJID"];) with this:

if (![memberJID isKindOfClass:[NSNull class]]) {
      [member setValue:memberJID forKey:@"memberJID"];
}

This should work, but I don't have a way to test.

@ceinem
Copy link
Author

ceinem commented Dec 4, 2019

Thanks for your reply. Right now I don't have a way to test it anymore. I accepted the loss of the group chats for now.
If I get another chance to test it, I will, and if successful create a Pull Request.

@residentsummer
Copy link
Owner

I'm afraid adding a simple null-check won't help here. A lot of things in the tool assumes that JID is not empty (e.g. group member objects are indexed by JID).

At the time of initial implementation, members that left conversation or changed JID were left as-is in the Android db, so those records won't pose a problem. Maybe that's not the case anymore...

More info is needed on why we've encounter null JID. Is that member was kicked from the group? Is this JID no longer active (don't know how to check this)?

loongyh added a commit to loongyh/watoi that referenced this issue Feb 15, 2020
Managed to come up with a fix for the null errors, inspired from the comment by [@Mc-muffin](residentsummer#22 (comment)). All chats including group chats transferred over intact, however group chats with members who quit have blank senders. Fixes residentsummer#22
@loongyh loongyh linked a pull request Feb 15, 2020 that will close this issue
@bruno-motacardoso
Copy link

That fix in #4 was a simple null-check, this one should be the same, so try changing line 257 in main.m ([member setValue:memberJID forKey:@"memberJID"];) with this:

if (![memberJID isKindOfClass:[NSNull class]]) {
      [member setValue:memberJID forKey:@"memberJID"];
}

This should work, but I don't have a way to test.

This worked for me, thanks.

@sobhanbera
Copy link

That fix in #4 was a simple null-check, this one should be the same, so try changing line 257 in main.m ([member setValue:memberJID forKey:@"memberJID"];) with this:

if (![memberJID isKindOfClass:[NSNull class]]) {
      [member setValue:memberJID forKey:@"memberJID"];
}

This should work, but I don't have a way to test.

Thanks a lot @Mc-muffin! This worked for me as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants