Skip to content

Issue #21: Missing Null Checks #21

@shadyashraf174

Description

@shadyashraf174

Issue #21: Missing Null Checks

Type: Contract Violation
Files: BlogPost.cs

Problematic Code:

public BlogPost(string title) // No null validation
{
    Title = title; // Potential NRE
}

Solution:

public BlogPost(string title)
{
    Title = title ?? throw new ArgumentNullException(nameof(title));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions