diff --git a/src/libpoketube/ptutils/libpt-coreutils.js b/src/libpoketube/ptutils/libpt-coreutils.js
index c4787820..013d8224 100644
--- a/src/libpoketube/ptutils/libpt-coreutils.js
+++ b/src/libpoketube/ptutils/libpt-coreutils.js
@@ -28,9 +28,9 @@ function convert(value) {
}
function getFirstLine(text) {
- var index = text.indexOf("
");
+ var index = text?.indexOf("
");
if (index === -1) index = undefined;
- return text.substring(0, index);
+ return text?.substring(0, index);
}
function capitalizeFirstLetter(string) {