瀏覽代碼

* 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
       exit;
     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;
   end;