浏览代码

Checking if Images are set

Source commit: a64747a9efd4dc8c4c2f9365a6be8c90a7752776
Martin Prikryl 1 年之前
父节点
当前提交
79dd86a15f
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      source/packages/filemng/CustomDriveView.pas

+ 6 - 1
source/packages/filemng/CustomDriveView.pas

@@ -309,7 +309,12 @@ var
   ImageHeight: Integer;
   TextHeight: Integer;
 begin
-  ImageHeight := (Images.Width * 9) div 8;
+  // Particularly when called from CMFontChanged because we are changing (reverting)
+  // the default form font, the Images might not be set up yet
+  if Assigned(Images) then
+    ImageHeight := (Images.Width * 9) div 8
+  else
+    ImageHeight := 0;
   // 16 seems to be the system default tree view item height
   TextHeight := ScaleByControlTextHeightRunTime(Canvas, 16);
   TreeView_SetItemHeight(Handle, Max(ImageHeight, TextHeight));