Why does first code work, but the second one gives segmentation fault.
I am providing minimal cpp files as attachments.
gdb:
Thread 1 "sfml.out" received signal SIGSEGV, Segmentation fault.
0x00007ffff7f5dbec in sf::Font::getTexture(unsigned int) const () from /usr/lib/libsfml-graphics.so.2.5
(gdb) ba
#0 0x00007ffff7f5dbec in sf::Font::getTexture(unsigned int) const () from /usr/lib/libsfml-graphics.so.2.5
#1 0x00007ffff7f99a4d in sf::Text::ensureGeometryUpdate() const () from /usr/lib/libsfml-graphics.so.2.5
#2 0x00007ffff7f9a34c in sf::Text::draw(sf::RenderTarget&, sf::RenderStates) const () from /usr/lib/libsfml-graphics.so.2.5
#3 0x00007ffff7f8bed9 in sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&) () from /usr/lib/libsfml-graphics.so.2.5
#4 0x00005555555564e6 in Game::draw (this=0x7fffffffe3d0) at notworking.cpp:37
#5 0x0000555555556540 in Game::loop (this=0x7fffffffe3d0) at notworking.cpp:42
#6 State::loop (this=this@entry=0x7fffffffe1c0) at notworking.cpp:60
#7 0x0000555555556340 in main () at notworking.cpp:65
Thanks in advance and sorry for bad looking post, it is my first time on this forum.