Runtime error with type

Hi,

I get this runtime error.
What is wrong here? (I just left the relevant code).

image

type
TPlayer = class
private
type TPersonalia = class
FirstName, LastName, FullName: string;
Age: Integer;
end;
var Personalia: TPersonalia;

private
type TCharacter = class
Stamina: Integer;
Health: Integer;
Strength: Integer;
end;
var Character: TCharacter;

private
type TAppearance = class
Description: string;
Outfit: string;
end;
var Appearance: TAppearance;

public
constructor Create;
end;

var
Player: TPlayer;

 constructor TPlayer.Create;
  begin
    inherited;
    Personalia := TPersonalia.Create;
    Character :=  TCharacter.Create;
    Appearance := TAppearance.Create;
  end;

end;

// '---------------------------------------------------------------------------

begin

Player.Personalia.FirstName:= ‘John’;

Application.Run;
end.

I do not see here any moment when you do Player := TPlayer.Create construction?

In general SIGSEGV at Player.Personalia.FirstName:= ‘John’; means that you either didn’t initialize Player, or didn’t initialize Player.Personalia as you should.

Is this the complete code that it compiles? A few things look here wrong, but I think you just pasted some subset of the actual code. It is best if you

  1. paste a complete source code that compiles

  2. to make it format nicely in the forum, surround the text with three backticks at beginning / end, similar to Markdown, like this:

```pascal
begin
  Writeln('piece of Pascal code');
end;
```
  1. if the text is longer, you should also be able to just attach it to your post.

Ups, that was it.
Now I put it in my initialization part and it works.

I will share the code in the “working with Scenes and Sprites” topic as it is part of this.