Skip to content

Commit 30b4024

Browse files
[CALC] Fix copy command when output is NaN (reactos#7496)
CORE-19745
1 parent 0d6316b commit 30b4024

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

base/applications/calc/winmain.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,10 +1015,16 @@ static void handle_copy_command(HWND hWnd)
10151015
TCHAR display[MAX_CALC_SIZE];
10161016
UINT n;
10171017

1018+
// Read current text from output display
10181019
n = GetDlgItemText(hWnd, IDC_TEXT_OUTPUT, display, SIZEOF(display));
10191020

1020-
if (calc.base == IDC_RADIO_DEC && _tcschr(calc.buffer, _T('.')) == NULL)
1021-
display[n - calc.sDecimal_len] = _T('\0');
1021+
// Check if result is a true number
1022+
if (!calc.is_nan)
1023+
{
1024+
// Remove trailing decimal point if no decimal digits exist
1025+
if (calc.base == IDC_RADIO_DEC && _tcschr(calc.buffer, _T('.')) == NULL)
1026+
display[n - calc.sDecimal_len] = _T('\0');
1027+
}
10221028

10231029
CopyMemToClipboard(display);
10241030
}

0 commit comments

Comments
 (0)