Skip to content

Commit 1c1ae21

Browse files
committed
StrView: equalsIgnoreCase() NPE
1 parent 81c6777 commit 1c1ae21

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/AudioTools/CoreAudio/AudioBasic/StrView.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class StrView {
163163

164164
/// checks if the string equals indicated parameter string
165165
virtual bool equals(const char* str) {
166-
if (str == nullptr) return false;
166+
if (str == nullptr) return isEmpty();
167167
return strcmp(this->chars, str) == 0;
168168
}
169169

@@ -561,7 +561,8 @@ class StrView {
561561
}
562562

563563
/// Compares the string ignoring the case
564-
virtual bool equalsIgnoreCase(const char* alt) const {
564+
virtual bool equalsIgnoreCase(const char* alt) {
565+
if (alt == nullptr) return isEmpty();
565566
if ((size_t)len != strlen(alt)) {
566567
return false;
567568
}

0 commit comments

Comments
 (0)