Reactos

[CALC] Fix copy command when output is NaN (#7496)

CORE-19745

authored by

Carlo Bramini and committed by
GitHub
30b40247 0d6316b0

+8 -2
+8 -2
base/applications/calc/winmain.c
··· 1015 1015 TCHAR display[MAX_CALC_SIZE]; 1016 1016 UINT n; 1017 1017 1018 + // Read current text from output display 1018 1019 n = GetDlgItemText(hWnd, IDC_TEXT_OUTPUT, display, SIZEOF(display)); 1019 1020 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 + } 1022 1028 1023 1029 CopyMemToClipboard(display); 1024 1030 }