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

Possible null-pointer-exception. #1967

Closed
textbrowser opened this issue Jul 5, 2021 · 2 comments · Fixed by #1968
Closed

Possible null-pointer-exception. #1967

textbrowser opened this issue Jul 5, 2021 · 2 comments · Fixed by #1968
Assignees

Comments

@textbrowser
Copy link

  • Android version:
  • Device:
  • Delta Chat version:
  • Expected behavior:
  • Actual behavior:
  • Steps to reproduce the problem:
  • Screenshots:
  • Logs:

deltachat-android/src/com/b44t/messenger/DcMsg.java

public static int[] msgSetToIds(final Set dcMsgs) {
int cnt = dcMsgs==null? 0 : dcMsgs.size(); // If dcMsgs is null, cnt is set to zero. See below.
int[] ids = new int[cnt];
int i = 0;
for (DcMsg dcMsg : dcMsgs) { // dcMsgs == null?
ids[i++] = dcMsg.getId();
}
return ids;
}

@adbenitez
Copy link
Member

in practice it is never null, but yes that method will fail if it receives null

@textbrowser
Copy link
Author

Sure, however, the original logic suggested that it could occur. :)
Thanks for the correction.

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.

2 participants