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

fix: Overflow error in Commit Dialog #7053

Conversation

palver123
Copy link
Contributor

DiffViewerLineNumberControl did not handle when MaxLineNumber was 0. Either an empty file can cause this (in this case _diffLines is empty so no problem) or a file where diff hunks were lost due to encoding errors.

Fixes #7023

Proposed changes

Change the current getter:

if (_visible && _diffLines.Any())
{
    int maxDigits = (int)Math.Log10(MaxLineNumber) + 1;
    return ...;
}

to

if (_visible && _diffLines.Any())
{
    int maxDigits = MaxLineNumber > 0 ?  ((int)Math.Log10(MaxLineNumber) + 1) : 0;
    return ...;
}

Test methodology

Tested manually.

Test environment(s)

  • Git 2.22.0.windows.1
  • Microsoft Windows NT 10.0.17134.0
  • .NET Framework 4.7.3416.0

✒️ I contribute this code under The Developer Certificate of Origin.

DiffViewerLineNumberControl did not handle when MaxLineNumber was 0. Either an empty file can cause this (in this case _diffLines is empty so no problem) or a file where diff hunks were lost due to encoding errors.

Fixes gitextensions#7023
@ghost ghost assigned palver123 Aug 26, 2019
@RussKie RussKie added the 📜 status: needs cla The author needs to update contributors.txt before reviewing or merging can proceed label Aug 27, 2019
@RussKie
Copy link
Member

RussKie commented Aug 27, 2019

Please send your sign off to contributors.txt in a separate PR. Thanks

@palver123
Copy link
Contributor Author

palver123 commented Aug 27, 2019

I've updated contributors.txt in #7061

@pmiossec pmiossec merged commit 85d4787 into gitextensions:master Aug 27, 2019
@pmiossec
Copy link
Member

Thanks.

@palver123 palver123 deleted the fix_7023_Overflow_error_in_commit_dialog branch August 27, 2019 15:26
@RussKie RussKie added 🖊️ status: cla signed and removed 📜 status: needs cla The author needs to update contributors.txt before reviewing or merging can proceed labels Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overflow error in Commit Dialog
3 participants