mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Crash on start with corrupted doublecmd.xml (issue #2430)
This commit is contained in:
parent
dbc4d890b7
commit
d1623e070d
2 changed files with 28 additions and 8 deletions
|
|
@ -215,6 +215,7 @@ begin
|
|||
LoadWindowsSpecialDir; // Load the list with special path. *Must* be located AFTER "LoadPaths" and BEFORE "InitGlobs"
|
||||
|
||||
if InitGlobs then
|
||||
begin
|
||||
//-- NOTE: before, only IsInstanceAllowed was called, and all the magic on creation
|
||||
// new instance or sending params to the existing server happened inside
|
||||
// IsInstanceAllowed() function as a side effect.
|
||||
|
|
@ -262,7 +263,7 @@ begin
|
|||
begin
|
||||
DCDebug('Another instance of DC is already running. Exiting.');
|
||||
end;
|
||||
|
||||
end;
|
||||
uKeyboard.CleanupKeyboard;
|
||||
DCDebug('Finished Double Commander');
|
||||
end.
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ uses
|
|||
uGlobsPaths, uLng, uShowMsg, uFileProcs, uOSUtils, uFindFiles, uEarlyConfig,
|
||||
dmHigh, uDCUtils, fMultiRename, uDCVersion, uDebug, uFileFunctions,
|
||||
uDefaultPlugins, Lua, uKeyboard, DCOSUtils, DCStrUtils, uPixMapManager,
|
||||
FileUtil, uSynDiffControls
|
||||
FileUtil, uSynDiffControls, InterfaceBase
|
||||
{$IF DEFINED(MSWINDOWS)}
|
||||
, ShlObj
|
||||
{$ENDIF}
|
||||
|
|
@ -853,14 +853,30 @@ begin
|
|||
end;
|
||||
|
||||
function AskUserOnError(var ErrorMessage: String): Boolean;
|
||||
var
|
||||
Button: TDialogButton;
|
||||
Buttons: TDialogButtons;
|
||||
begin
|
||||
// Show error messages.
|
||||
if ErrorMessage <> EmptyStr then
|
||||
begin
|
||||
Result := QuestionDlg(Application.Title + ' - ' + rsMsgErrorLoadingConfiguration,
|
||||
ErrorMessage, mtWarning,
|
||||
[1, rsDlgButtonContinue, 'isdefault',
|
||||
2, rsDlgButtonExitProgram], 0) = 1;
|
||||
Buttons:= TDialogButtons.Create(TDialogButton);
|
||||
try
|
||||
Button:= Buttons.Add;
|
||||
Button.Default:= True;
|
||||
Button.ModalResult:= mrOK;
|
||||
Button.Caption:= rsDlgButtonContinue;
|
||||
|
||||
Button:= Buttons.Add;
|
||||
Button.Cancel:= True;
|
||||
Button.ModalResult:= mrAbort;
|
||||
Button.Caption:= rsDlgButtonExitProgram;
|
||||
|
||||
Result := DefaultQuestionDialog(Application.Title + ' - ' + rsMsgErrorLoadingConfiguration,
|
||||
ErrorMessage, idDialogWarning, Buttons, 0) = mrOK;
|
||||
finally
|
||||
Buttons.Free;
|
||||
end;
|
||||
// Reset error message.
|
||||
ErrorMessage := '';
|
||||
end
|
||||
|
|
@ -2304,8 +2320,11 @@ begin
|
|||
begin
|
||||
if mbFileAccess(gpGlobalCfgDir + 'doublecmd.xml', fmOpenRead or fmShareDenyWrite) then
|
||||
begin
|
||||
LoadConfigCheckErrors(@LoadGlobalConfig, gpGlobalCfgDir + 'doublecmd.xml', ErrorMessage);
|
||||
if gConfig.TryGetValue(gConfig.RootNode, 'Configuration/UseConfigInProgramDir', gUseConfigInProgramDir) then
|
||||
if not LoadConfigCheckErrors(@LoadGlobalConfig, gpGlobalCfgDir + 'doublecmd.xml', ErrorMessage) then
|
||||
begin
|
||||
if not gUseConfigInProgramDir then ErrorMessage := EmptyStr;
|
||||
end
|
||||
else if gConfig.TryGetValue(gConfig.RootNode, 'Configuration/UseConfigInProgramDir', gUseConfigInProgramDir) then
|
||||
begin
|
||||
gConfig.DeleteNode(gConfig.RootNode, 'Configuration/UseConfigInProgramDir');
|
||||
if not gUseConfigInProgramDir then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue