Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Fixes null case for fields #13753

Merged
merged 1 commit into from
Apr 19, 2018
Merged

Fixes null case for fields #13753

merged 1 commit into from
Apr 19, 2018

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Apr 6, 2018

Resolves #13751

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed. (Ask a Brave employee to help if you cannot access this document.)

Test Plan:

  • start browser with LEDGER_VERBOSE=true flag
  • make sure that there is no null error

Reviewer Checklist:

  • Request a security/privacy review as needed if one was not already requested.

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

Copy link
Contributor

@ryanml ryanml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NejcZdovc This works well, but overall we are just doing a falsy check for field (seems to be able to be either false or undefined)

In this case inside a forEach, I feel it's a little cleaner to stick the fail case at the top of the callback like:

if (!field) return

Resolves brave#13751

Auditors:

Test Plan:
@NejcZdovc
Copy link
Contributor Author

@ryanml I agree, your approach is cleaner. Code changed

@NejcZdovc NejcZdovc requested a review from ryanml April 18, 2018 08:14
@codecov-io
Copy link

codecov-io commented Apr 18, 2018

Codecov Report

Merging #13753 into master will decrease coverage by 0.03%.
The diff coverage is 40%.

@@            Coverage Diff             @@
##           master   #13753      +/-   ##
==========================================
- Coverage   56.63%   56.59%   -0.04%     
==========================================
  Files         283      283              
  Lines       28848    28849       +1     
  Branches     4784     4785       +1     
==========================================
- Hits        16338    16328      -10     
- Misses      12510    12521      +11
Flag Coverage Δ
#unittest 56.59% <40%> (-0.04%) ⬇️
Impacted Files Coverage Δ
app/browser/api/ledger.js 62.76% <40%> (-0.08%) ⬇️
js/stores/appStoreRenderer.js 91.66% <0%> (-8.34%) ⬇️
app/renderer/components/reduxComponent.js 57.75% <0%> (-3.45%) ⬇️
js/stores/windowStore.js 28.46% <0%> (-0.3%) ⬇️

Copy link
Contributor

@ryanml ryanml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! 👍

@NejcZdovc NejcZdovc added this to the Completed work milestone Apr 18, 2018
Copy link
Contributor

@jasonrsadler jasonrsadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🥇

@NejcZdovc NejcZdovc modified the milestones: Completed work, 0.22.x Release 3 (Beta channel) Apr 19, 2018
@NejcZdovc NejcZdovc merged commit a4cdee8 into brave:master Apr 19, 2018
NejcZdovc added a commit that referenced this pull request Apr 19, 2018
NejcZdovc added a commit that referenced this pull request Apr 19, 2018
@NejcZdovc
Copy link
Contributor Author

master a4cdee8
0.23 9826e31
0.22 ef4f0f8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants