mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Crash with invalid default format settings (fixes #2772)
This commit is contained in:
parent
5f6bfb8b5a
commit
f8342e72a1
2 changed files with 21 additions and 3 deletions
|
|
@ -180,9 +180,9 @@ begin
|
|||
begin
|
||||
DefaultFormatSettings.ThousandSeparator:= ' ';
|
||||
end;
|
||||
{$IFDEF UNIX}
|
||||
uMyUnix.FixDateTimeSeparators;
|
||||
{$ENDIF}
|
||||
{$IF DEFINED(UNIX)}
|
||||
uMyUnix.FixFormatSettings;
|
||||
{$ENDIF}
|
||||
FixDateNamesToUTF8;
|
||||
|
||||
DCDebug(GetVersionInformation);
|
||||
|
|
|
|||
|
|
@ -118,6 +118,10 @@ function FindExecutableInSystemPath(var FileName: String): Boolean;
|
|||
function ExecutableInSystemPath(const FileName: String): Boolean;
|
||||
function GetDefaultAppCmd(const FileName: String): String;
|
||||
function GetFileMimeType(const FileName: String): String;
|
||||
{en
|
||||
Fix invalid default format settings
|
||||
}
|
||||
procedure FixFormatSettings;
|
||||
{en
|
||||
Fix separators in case they are broken UTF-8 characters
|
||||
(FPC takes only first byte as it doesn't support Unicode).
|
||||
|
|
@ -369,6 +373,20 @@ begin
|
|||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure FixFormatSettings;
|
||||
begin
|
||||
try
|
||||
FormatDateTime(DefaultFormatSettings.ShortDateFormat, Now);
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
DebugLn('Warning: %s (%s)', [E.Message, DefaultFormatSettings.ShortDateFormat]);
|
||||
DefaultFormatSettings.ShortDateFormat:= 'yyyy.mm.dd';
|
||||
end;
|
||||
end;
|
||||
FixDateTimeSeparators;
|
||||
end;
|
||||
|
||||
procedure FixDateTimeSeparators;
|
||||
var
|
||||
TimeEnv: String;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue