Browse Source

--- Merging r14870 into '.':
U rtl/inc/objpas.inc
A tests/webtbs/tw15690.pp

# revisions: 14870
------------------------------------------------------------------------
r14870 | jonas | 2010-02-06 19:14:26 +0100 (Sat, 06 Feb 2010) | 2 lines
Changed paths:
M /trunk/rtl/inc/objpas.inc
A /trunk/tests/webtbs/tw15690.pp

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

------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@15060 -

marco 15 years ago
parent
commit
aab3ad087d
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

@@ -9462,6 +9462,7 @@ tests/webtbs/tw15377.pp svneol=native#text/pascal
 tests/webtbs/tw1539.pp svneol=native#text/plain
 tests/webtbs/tw15467.pp svneol=native#text/pascal
 tests/webtbs/tw1567.pp svneol=native#text/plain
+tests/webtbs/tw15690.pp svneol=native#text/plain
 tests/webtbs/tw1573.pp svneol=native#text/plain
 tests/webtbs/tw1592.pp svneol=native#text/plain
 tests/webtbs/tw1617.pp svneol=native#text/plain

+ 9 - 4
rtl/inc/objpas.inc

@@ -409,10 +409,15 @@
            vmt: PVmt;
 
         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;
 
       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.