Browse Source

* tobject.inheritsfrom(nil) has to return false (mantis #15690)

git-svn-id: trunk@14870 -
Jonas Maebe 15 years ago
parent
commit
b1d2ab5450
3 changed files with 16 additions and 4 deletions
  1. 1 0
      .gitattributes
  2. 9 4
      rtl/inc/objpas.inc
  3. 6 0
      tests/webtbs/tw15690.pp

+ 1 - 0
.gitattributes

@@ -10276,6 +10276,7 @@ tests/webtbs/tw15530.pp svneol=native#text/pascal
 tests/webtbs/tw15607.pp svneol=native#text/plain
 tests/webtbs/tw15607.pp svneol=native#text/plain
 tests/webtbs/tw15619.pp svneol=native#text/plain
 tests/webtbs/tw15619.pp svneol=native#text/plain
 tests/webtbs/tw1567.pp svneol=native#text/plain
 tests/webtbs/tw1567.pp svneol=native#text/plain
+tests/webtbs/tw15690.pp svneol=native#text/plain
 tests/webtbs/tw15693.pp svneol=native#text/plain
 tests/webtbs/tw15693.pp svneol=native#text/plain
 tests/webtbs/tw1573.pp svneol=native#text/plain
 tests/webtbs/tw1573.pp svneol=native#text/plain
 tests/webtbs/tw1592.pp svneol=native#text/plain
 tests/webtbs/tw1592.pp svneol=native#text/plain

+ 9 - 4
rtl/inc/objpas.inc

@@ -409,10 +409,15 @@
            vmt: PVmt;
            vmt: PVmt;
 
 
         begin
         begin
-           vmt:=PVmt(self);
-           while assigned(vmt) and (vmt <> PVmt(aclass)) do
-             vmt := vmt^.vParent;
-           InheritsFrom := (vmt = PVmt(aclass));
+           if assigned(aclass) then
+             begin
+               vmt:=PVmt(self);
+               while assigned(vmt) and (vmt <> PVmt(aclass)) do
+                 vmt := vmt^.vParent;
+               InheritsFrom := (vmt = PVmt(aclass));
+             end
+           else
+             inheritsFrom := False;
         end;
         end;
 
 
       class function TObject.stringmessagetable : pstringmessagetable;
       class function TObject.stringmessagetable : pstringmessagetable;

+ 6 - 0
tests/webtbs/tw15690.pp

@@ -0,0 +1,6 @@
+{$mode objfpc}
+
+begin
+  if tobject.inheritsfrom(nil) then
+    halt(1);
+end.