Skip to content

Commit

Permalink
Merge pull request #4 from omelhoro/patch-1
Browse files Browse the repository at this point in the history
Guard against undefined
  • Loading branch information
aegyed91 authored Oct 12, 2016
2 parents deacf96 + 74ee203 commit 39cd881
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export function storeFreeze(reducer): ActionReducer<any> {
return function (state = {}, action) {

deepFreeze(state);
deepFreeze(action.payload);

// guard against trying to freeze null or undefined types
if (action.payload) {
deepFreeze(action.payload);
}

let nextState;

Expand Down

0 comments on commit 39cd881

Please sign in to comment.