Skip to content

Commit

Permalink
Merge pull request #8 from ulex/master
Browse files Browse the repository at this point in the history
Fix unhandled exceptions
  • Loading branch information
hhu-mahmoud authored Jan 20, 2022
2 parents 8cc354b + a7c31b6 commit a71c0a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Exceptional/Models/ConstructorDeclarationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ConstructorDeclarationModel(IConstructorDeclaration constructorDeclaratio
var containingType = constructorDeclaration.DeclaredElement.GetContainingType();
var baseClass = containingType?.GetSuperTypes().FirstOrDefault(t => !t.IsInterfaceType());
var baseClassTypeElement = baseClass?.GetTypeElement();
var defaultBaseConstructor = baseClassTypeElement?.Constructors.First(c => c.IsDefault);
var defaultBaseConstructor = baseClassTypeElement?.Constructors.FirstOrDefault(c => c.IsDefault);
if (defaultBaseConstructor != null)
{
ThrownExceptions.Add(new ConstructorInitializerModel(this, defaultBaseConstructor, this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public bool Throws(IDeclaredType exceptionType)

private IDeclaredType GetExceptionType()
{
if (Node.Exception != null)
if (Node?.Exception != null)
{
return Node.Exception.GetExpressionType() as IDeclaredType;
}
Expand Down

0 comments on commit a71c0a3

Please sign in to comment.