Skip to content

Commit dee20f9

Browse files
committed
Avoid infinite loop in ChannelVideo's to_xml/to_json methods
1 parent 12b818a commit dee20f9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/invidious/channels/channels.cr

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ struct ChannelVideo
4444
end
4545
end
4646

47-
def to_json(locale, json : JSON::Builder | Nil = nil)
48-
if json
47+
def to_json(locale, _json : Nil = nil)
48+
JSON.build do |json|
4949
to_json(locale, json)
50-
else
51-
JSON.build do |json|
52-
to_json(locale, json)
53-
end
5450
end
5551
end
5652

@@ -88,13 +84,9 @@ struct ChannelVideo
8884
end
8985
end
9086

91-
def to_xml(locale, xml : XML::Builder | Nil = nil)
92-
if xml
87+
def to_xml(locale, _xml : Nil = nil)
88+
XML.build do |xml|
9389
to_xml(locale, xml)
94-
else
95-
XML.build do |xml|
96-
to_xml(locale, xml)
97-
end
9890
end
9991
end
10092

0 commit comments

Comments
 (0)