Skip to content

Commit

Permalink
fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Slatcher committed Oct 19, 2018
1 parent 1266dd2 commit f14c982
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions projects/app/src/pages/components/PlayerChooser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as React from "react";
export interface PlayerChooserProps {
players: IPlayer[];
selectedPlayer: IPlayer | undefined | null;
onPlayerChanged(player: IPlayer | undefined): void;
onPlayerChanged(player: IPlayer | null): void;
}

export class PlayerChooser extends React.PureComponent<PlayerChooserProps, {}> {
Expand All @@ -27,6 +27,6 @@ export class PlayerChooser extends React.PureComponent<PlayerChooserProps, {}> {
private handlePlayerChooserChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
const playerId = event.target.value;
const player = this.props.players.find(p => p.id.toString() === playerId);
this.props.onPlayerChanged(playerId === "" ? undefined : player);
this.props.onPlayerChanged(playerId === "" || !player ? null : player);
};
}

0 comments on commit f14c982

Please sign in to comment.