Răsfoiți Sursa

FIX: possible crash when selecting the Viewer category in the Hotkeys Option dialog

rich2014 2 luni în urmă
părinte
comite
f65507b9ae
1 a modificat fișierele cu 13 adăugiri și 0 ștergeri
  1. 13 0
      src/fviewer.pas

+ 13 - 0
src/fviewer.pas

@@ -786,6 +786,19 @@ var
   bmpThumb: TBitmap;
   AIndex, X, Y: Integer;
 begin
+
+  // in TfrmOptionsHotkeys.FillCommandList(), a TfrmViewer instance may be created
+  // to obtain Hotkeys.
+  // in this case, the TfrmViewer is not initialized normally, and an exception
+  // may occur in some WidgetSets due to the Paint event.
+  // therefore, the code is added here.
+  // this is a hack-like patch, and the root cause is that the implementation of
+  // TfrmOptionsHotkeys.FillCommandList() is unreasonable.
+  // to completely avoid such issue, TfrmOptionsHotkeys.FillCommandList() should
+  // be reimplemented in the future.
+  if FFileList = nil then
+    Exit;
+
   AIndex:= CellToIndex(aCol, aRow);
 
   if InRange(AIndex, 0, FFileList.Count - 1) then