question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing null checks

See original GitHub issue

I’m playing around with nullable reference types in this branch. So far I’ve found several places that could benefit from an extra null check.

I’ll try to keep the branch in sync with master as the null checks are merged.

ReferenceTypeAssertions
	BeAssignableTo
	BeAssignableTo<T>
		null Subject

ComparableTypeAssertions
	Be
		null Subject
	
NumericAssertions
	BeOfType
	NotBeOfType
		null Subject
		
ActionAssertions
	NotThrow
	InvokeSubjectWithInterception (public methods that calls it)
		null Subject
		
AsyncFunctionAssertions
	NotThrow
	NotThrowAsync
	NotThrow<TException>
	NotThrowAsync<TException>
	InvokeSubjectWithInterception (public methods that calls it)
	InvokeSubjectWithInterceptionAsync (public methods that calls it)
		null Subject
		
FunctionAssertions
	NotThrow
	NotThrow<TException>
	InvokeSubjectWithInterception (public methods that calls it)
	NotThrowAfter
		null Subject
		
AssemblyAssertions
	DefineType
		null Subject
	Reference
	NotReference
		null Subject
		null assembly
		
ExecutionTimeAssertions
	ctor
		null action
		null Func<T>

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:25 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
eNeRGy164commented, Jun 3, 2021

I’ll pick up ReferenceTypeAssertions, StringCollectionAssertions and GenericCollectionAssertions first. I have confirmed the NRE’s in all those methods

So, that were only 50 methods (excluding overloads)… pfff

1reaction
jnyrupcommented, May 15, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing Check against Null - java
If this code is going to be invoked during a HTTP request, all these null checks are junk. There isn't a valid state...
Read more >
Unchecked Return Value Missing Check against Null
Ignoring a method's return value can cause the program to overlook unexpected states and conditions. Just about every serious attack on a software...
Read more >
Avoid Check for Null Statement in Java
Learn several strategies for avoiding the all-too-familiar boilerplate conditional statements to check for null values in Java.
Read more >
Should one check for null if he does not expect null?
On one side, checking for null where you are not expecting it (i.e. have no user interface to handle it) is, in my...
Read more >
Why I never null-check parameters - The New Java Developer
The simple reason to check for nulls is the fear of the NullPointerException , ingrained in every Java developer. There is a famous...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found