Skip to content

Potential fix for code scanning alert no. 15: Useless null check - #83

Draft
InvalidDavid wants to merge 1 commit into
masterfrom
alert-autofix-15
Draft

Potential fix for code scanning alert no. 15: Useless null check#83
InvalidDavid wants to merge 1 commit into
masterfrom
alert-autofix-15

Conversation

@InvalidDavid

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/InvalidDavid/UMA/security/code-scanning/15

Remove the useless null-safe call and keep behavior unchanged by directly parsing the string and preserving the same fallback to 0L when parsing fails.

Best fix in this file region (getDetails, around lines 267–268):

  • Keep dateStr assignment as-is.
  • Replace:
    • val uploadDate = dateStr?.let { dateFormat.parseSafe(it) } ?: 0L
  • With:
    • val uploadDate = dateFormat.parseSafe(dateStr) ?: 0L

This preserves existing functionality:

  • If datetime is absent, attr("datetime") gives "".
  • parseSafe("") should return null (same as failed parse), then ?: 0L applies exactly as before.

No imports, new methods, or dependencies are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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 this pull request may close these issues.

1 participant