Skip to content

Commit 0b85b82

Browse files
committed
fallback to empty string if key doesn't exist
1 parent 42e8e96 commit 0b85b82

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

php-templates/translations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function linesFromJsonFile($file)
111111

112112
foreach ($encoded as $index => $keys) {
113113
// Pretty likely the be on the line that is the index, go happy path first
114-
if (strpos($lines[$index + 1], $keys[0]) !== false) {
114+
if (strpos($lines[$index + 1] ?? '', $keys[0]) !== false) {
115115
$result[$keys[1]] = $index + 2;
116116
continue;
117117
}

src/templates/translations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ $translator = new class
111111
112112
foreach ($encoded as $index => $keys) {
113113
// Pretty likely the be on the line that is the index, go happy path first
114-
if (strpos($lines[$index + 1], $keys[0]) !== false) {
114+
if (strpos($lines[$index + 1] ?? '', $keys[0]) !== false) {
115115
$result[$keys[1]] = $index + 2;
116116
continue;
117117
}

0 commit comments

Comments
 (0)