# Crash on using GetWorld()-\>GetMapName();,

**URL:** <https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691>\
**Category:** World Creation\
**Tags:** world, editor-crash, unreal-engine, level, CPP, question\
**Created:** [February 22, 2015, 3:45am UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691 "2015-02-22T03:45:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![GooseJS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GooseJS](https://forums.unrealengine.com/u/GooseJS)\
**Post date:** [February 22, 2015, 3:45am UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/1 "2015-02-22T03:45:30Z")

</div>

Well, as the title says. My crash log is [here](http://pastebin.com/9rhzB8zd) on pastebin and attached below. For now I have that line commented out. Any help would be appreciated!

```
MachineId:5108FDC44226A2DE35420EB1D2559CF5
EpicAccountId:50aacbd7463743c38276ef5f549ccfaf

Access violation - code c0000005 (first/second chance not available)

UE4Editor_CoreUObject + 1418634 bytes
UE4Editor_Engine + 9874002 bytes
UE4Editor_FLR_6001!AFLRCharacter::AFLRCharacter() + 784 bytes [f:\documents\unreal projects\flr\source\flr\private\flrcharacter.cpp:57]
UE4Editor_CoreUObject + 394351 bytes
UE4Editor_CoreUObject + 1592305 bytes
UE4Editor_CoreUObject + 1478354 bytes
UE4Editor_CoreUObject + 426071 bytes
UE4Editor_Core + 467600 bytes
UE4Editor_Core + 2132957 bytes
UE4Editor_Projects + 103181 bytes
UE4Editor_Projects + 103836 bytes
UE4Editor!FEngineLoop::LoadStartupModules() + 75 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launchengineloop.cpp:1814]
UE4Editor!FEngineLoop::PreInit() + 10828 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launchengineloop.cpp:1373]
UE4Editor!GuardedMain() + 236 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launch.cpp:110]
UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

```

---

<div class="post-metadata">

**Author:** ![zamy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zamy](https://forums.unrealengine.com/u/zamy)\
**Post date:** [February 22, 2015, 11:26am UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/2 "2015-02-22T11:26:40Z")

</div>

Where are you using it?

---

<div class="post-metadata">

**Author:** ![GooseJS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GooseJS](https://forums.unrealengine.com/u/GooseJS)\
**Post date:** [February 22, 2015, 9:48pm UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/3 "2015-02-22T21:48:06Z")

</div>

In the player constructor… I’m assuming the issue is that he loads in before the level?

---

<div class="post-metadata">

**Author:** ![MickD777](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MickD777](https://forums.unrealengine.com/u/MickD777)\
**Post date:** [February 22, 2015, 10:12pm UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/4 "2015-02-22T22:12:30Z")

</div>

From what I understand, the GetWorld() is only a reference getter on your actor. GetWorld() could be not valid, but it does not mean the World is not up. Also, doing this in the constructor is probably not safe, since the constructor is called for every class at the start of the Editor (or Engine).

I personally use the GetWorld() from the GameInstance class to get my World Ref as it seems to be referenced there as soon as the GameInstance is created.

Hope this can help you.

Mick

---

<div class="post-metadata">

**Author:** ![GooseJS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GooseJS](https://forums.unrealengine.com/u/GooseJS)\
**Post date:** [February 22, 2015, 10:26pm UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/5 "2015-02-22T22:26:31Z")

</div>

Yup, got it. Thanks!

---

<div class="post-metadata">

**Author:** ![GooseJS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GooseJS](https://forums.unrealengine.com/u/GooseJS)\
**Post date:** [February 22, 2015, 10:27pm UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/6 "2015-02-22T22:27:46Z")

</div>

Solved thanks to Michaël Dubé. I just had to move it out of the player constructor.

---

<div class="post-metadata">

**Author:** ![MickD777](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MickD777](https://forums.unrealengine.com/u/MickD777)\
**Post date:** [February 22, 2015, 10:52pm UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/7 "2015-02-22T22:52:12Z")

</div>

I just switched my comment into answer, would be great if you can flag it as accepted 🙂

Mick

---

<div class="post-metadata">

**Author:** ![GaskinDesigns](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GaskinDesigns](https://forums.unrealengine.com/u/GaskinDesigns)\
**Post date:** [May 31, 2024, 7:31pm UTC](https://forums.unrealengine.com/t/crash-on-using-getworld-getmapname/307691/8 "2024-05-31T19:31:55Z")

</div>

THANK YOU!!!
