fix some npes

This commit is contained in:
Benjamin Pasero
2015-12-09 07:44:30 +01:00
parent 88d91e54c6
commit eb17ea787b
2 changed files with 5 additions and 1 deletions

View File

@@ -622,6 +622,10 @@ export function startsWithUTF8BOM(str: string): boolean {
export function score(target: string, query: string): number {
let score = 0;
if (!target || !query) {
return score; // return early if target or query are undefined
}
const queryLen = query.length;
const targetLower = target.toLowerCase();
const queryLower = query.toLowerCase();

View File

@@ -186,7 +186,7 @@ export class QuickOpenEntry {
}
}
return compareAnything(nameA, nameB, lookFor.toLowerCase());
return compareAnything(nameA, nameB, lookFor ? lookFor.toLowerCase() : lookFor);
}
/**