Skip to content

Commit

Permalink
Bugfix: Search crashes webpart when its empty
Browse files Browse the repository at this point in the history
When you type something in the search bar, search and get your result then erase and press enter it will crash the webpart.
  • Loading branch information
AntonBrodin authored Sep 15, 2021
1 parent c3f44cf commit 99dd68e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class PeopleDirectory extends React.Component<IPeopleDirectoryProps, IPeo
// if no search query has been specified, retrieve people whose last name begins with the
// specified letter. if a search query has been specified, escape any ' (single quotes)
// by replacing them with two '' (single quotes). Without this, the search query would fail
const query: string = searchQuery === null ? `LastName:${index}*` : searchQuery.replace(/'/g, `''`);
const query: string = searchQuery === null || searchQuery.length <= 0 ? `LastName:${index}*` : searchQuery.replace(/'/g, `''`);

// retrieve information about people using SharePoint People Search
// sort results ascending by the last name
Expand Down

0 comments on commit 99dd68e

Please sign in to comment.