Преглед на файлове

* Patch from Graeme Geldenhuys to check for XMLDocument before typecasting it

git-svn-id: trunk@16443 -
michael преди 15 години
родител
ревизия
a8e4234aca
променени са 1 файла, в които са добавени 10 реда и са изтрити 7 реда
  1. 10 7
      packages/fcl-xml/src/xmlwrite.pp

+ 10 - 7
packages/fcl-xml/src/xmlwrite.pp

@@ -681,14 +681,17 @@ begin
   wrtStr('?>');
   wrtStr('?>');
 
 
   // TODO: now handled as a regular PI, remove this?
   // TODO: now handled as a regular PI, remove this?
-  if Length(TXMLDocument(node).StylesheetType) > 0 then
+  if node is TXMLDocument then
   begin
   begin
-    wrtStr(FLineBreak);
-    wrtStr('<?xml-stylesheet type="');
-    wrtStr(TXMLDocument(node).StylesheetType);
-    wrtStr('" href="');
-    wrtStr(TXMLDocument(node).StylesheetHRef);
-    wrtStr('"?>');
+    if Length(TXMLDocument(node).StylesheetType) > 0 then
+    begin
+      wrtStr(FLineBreak);
+      wrtStr('<?xml-stylesheet type="');
+      wrtStr(TXMLDocument(node).StylesheetType);
+      wrtStr('" href="');
+      wrtStr(TXMLDocument(node).StylesheetHRef);
+      wrtStr('"?>');
+    end;
   end;
   end;
 
 
   child := node.FirstChild;
   child := node.FirstChild;