浏览代码

* Fixed Issue ID38920: twriter crashes on readonly nil component

git-svn-id: trunk@49389 -
michael 4 年之前
父节点
当前提交
61cd38e6db
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      rtl/objpas/classes/writer.inc

+ 3 - 2
rtl/objpas/classes/writer.inc

@@ -892,8 +892,9 @@ begin
     if PropType^.Kind<>tkClass then
     if PropType^.Kind<>tkClass then
       exit;
       exit;
     ObjValue := TObject(GetObjectProp(Instance, PropInfo));
     ObjValue := TObject(GetObjectProp(Instance, PropInfo));
-    if not ObjValue.InheritsFrom(TComponent) or
-       not (csSubComponent in TComponent(ObjValue).ComponentStyle) then
+    if not (assigned(ObjValue) and
+            ObjValue.InheritsFrom(TComponent) and
+            (csSubComponent in TComponent(ObjValue).ComponentStyle)) then
       exit;
       exit;
   end;
   end;