Donate Share

SimpleRSS

Tracker: Support Requests

5 Exception with emtpy <width/> and <height/> elements - ID: 2858434
Last Update: Tracker Item Submitted ( bheine )

This code crashes converting Null to integer with emtpy <width/> and
<height/> elements:

procedure TSimpleParserRSS.Parse;
...
if ChildNodes.Nodes[Counter].ChildNodes.FindNode(reWidth) <>
nil then
FSimpleRSS.Channel.Optional.Image.Optional.Width :=

ChildNodes.Nodes[Counter].ChildNodes.FindNode(reWidth).NodeValue;
if ChildNodes.Nodes[Counter].ChildNodes.FindNode(reHeight) <>
nil then
FSimpleRSS.Channel.Optional.Image.Optional.Height :=

ChildNodes.Nodes[Counter].ChildNodes.FindNode(reHeight).NodeValue;

My solution:

procedure TSimpleParserRSS.Parse;
var tVar: OleVariant;
...
if ChildNodes.Nodes[Counter].ChildNodes.FindNode(reWidth) <>
nil then
begin
tVar :=
ChildNodes.Nodes[Counter].ChildNodes.FindNode(reWidth).NodeValue;
if not VarIsNull(tVar)then
FSimpleRSS.Channel.Optional.Image.Optional.Width := tVar;
end;
if ChildNodes.Nodes[Counter].ChildNodes.FindNode(reHeight) <>
nil then
begin
tVar :=
ChildNodes.Nodes[Counter].ChildNodes.FindNode(reHeight).NodeValue;
if not VarIsNull(tVar)then
FSimpleRSS.Channel.Optional.Image.Optional.Height := tVar;
end;


bhe bhe ( bheine ) - 2009-09-14 08:17

5

Open

None

Nobody/Anonymous

Bug

None

Public


Comments

No follow-up comments have been posted.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.