Camera Component Crash

Im having an issue with my code for the camera crashing my Unreal Editor.
I was able to compile the camera component and test. Once I setup the springarm component, it broke my camera component code somewhere.
I had to delete all the files in my Binary/64 folders and that didnt work. I commented out all the spring arm code and that didnt work. Only when I commented out all the camera code was i able to get the project to get past 71% and open.
Here is the code. If there is anything you can see that might be causing it I’d be grateful.

----------------.h file-----------------------
#pragma once

#include “CoreMinimal.h”
#include “GameFramework/Character.h”
#include “SCharacter.generated.h”

//class UCameraComponent;

UCLASS()
class SILENTRED_API ASCharacter : public ACharacter
{
GENERATED_BODY()

public:
// Sets default values for this character’s properties
ASCharacter();

protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;

void MoveForward(float Value);
void MoveRight(float Value);

//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
//UCameraComponent* CameraComp;

//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
//USpringArmComponent* SpringArmComp;

public:
// Called every frame
virtual void Tick(float DeltaTime) override;

// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

};
-------------.CPP file-----------
#include “SCharacter.h”
//#include “Camera/CameraComponent.h”

// Sets default values
ASCharacter::ASCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don’t need it.
PrimaryActorTick.bCanEverTick = true;

//CameraComp->bUsePawnControlRotation = true;


//CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComp"));

}

// Called when the game starts or when spawned
void ASCharacter::BeginPlay()
{
Super::BeginPlay();

}

void ASCharacter::MoveForward(float Value)
{
AddMovementInput(GetActorForwardVector() * Value);
}

void ASCharacter::MoveRight(float Value)
{
AddMovementInput(GetActorRightVector() * Value);
}

// Called every frame
void ASCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

}

// Called to bind functionality to input
void ASCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);

PlayerInputComponent->BindAxis("MoveForward", this, &ASCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &ASCharacter::MoveRight);
PlayerInputComponent->BindAxis("LookUp", this, &ASCharacter::AddControllerPitchInput);
PlayerInputComponent->BindAxis("Turn", this, &ASCharacter::AddControllerYawInput);

}

After Commenting Each line of camera code out one by one I figured out that
CameraComp->bUsePawnControlRotation = true; is causing the issues. Every time is compile in Visual Studio and it hot compiles in UR4 it crashes. I still do not know why this is happening so still looking for some direction please.

the problem is in that code :

CameraComp->bUsePawnControlRotation = true;
 
CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComp"));

you try to set a variable when the pointer is still null

and you asign it on the next line.
So the fix would be to swap the line :

CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComp"));

CameraComp->bUsePawnControlRotation = true;

I tried this but still get the crash at 71%. There is one thing I need to check before can say that this didnt work when I get home. I let you know the results.

This did do the trick once I found out that it changed a controller setting in the blueprints. Once i was able to load the project and set it to default and swap the lines of code the crashing stopped and everything worked as is should.
Thank you for your help.