fix: check if node has attributes before accessing them

This commit is contained in:
oSumAtrIX 2022-07-18 01:50:02 +02:00
parent 36af4cc14f
commit 2d2ed870da
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -88,7 +88,7 @@ class SponsorBlockResourcePatch : ResourcePatch() {
val view = children.item(i)
// Replace the attribute for a specific node only
if (!view.attributes.getNamedItem("android:id").nodeValue.endsWith("live_chat_overlay_button")) continue
if (!(view.hasAttributes() && view.attributes.getNamedItem("android:id").nodeValue.endsWith("live_chat_overlay_button"))) continue
// voting button id from the voting button view from the youtube_controls_layout.xml host file
val votingButtonId = "@+id/voting_button"