# Blueprint Map Type with C++ Enum Key and Default Values causes Crash

**URL:** <https://forums.unrealengine.com/t/blueprint-map-type-with-c-enum-key-and-default-values-causes-crash/391979>\
**Category:** Blueprint\
**Tags:** unreal-engine, crash, bug-report, CPP, Blueprint, question\
**Created:** [April 26, 2017, 2:41pm UTC](https://forums.unrealengine.com/t/blueprint-map-type-with-c-enum-key-and-default-values-causes-crash/391979 "2017-04-26T14:41:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MilanRadeta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MilanRadeta](https://forums.unrealengine.com/u/MilanRadeta)\
**Post date:** [April 26, 2017, 2:41pm UTC](https://forums.unrealengine.com/t/blueprint-map-type-with-c-enum-key-and-default-values-causes-crash/391979/1 "2017-04-26T14:41:13Z")

</div>

A problem occured when I wanted to use a map variable that had the same C++ Enum for key and value type, which had default values.  
Everything worked until the project was closed and reopened.  
While trying to reopen, Unreal Engine crashed.  
I figured the problem out after reverting changes from newest revisions on my SVN repository.

So, I tried to reproduce the same crash in new project.  
And I succeeded in doing so, although the crash didn’t happen when opening the project.  
Instead it crashed when opening an asset (in this case, map level) which used a map variable with C++ enum for key, which had default values.

Steps to reproduce:

1. Create New Project
2. Create New C++ class
3. In header file add new enum class (  
`UENUM(BlueprintType) enum class ETestEnum : uint8 { A, B, C};`  
)
4. Rebuild Project
5. Create New Map Level
6. Open New Map Level Blueprint
7. Create new map variable which has the c++ enum class (  
`ETestEnum`  
) for key
8. Add at least 1 item to default values (this seems to be the crash causer)
9. Close The Project
10. Reopen The Project
11. Try Opening the created Map
12. Crash

For now, I use the workaround with enum switch, but as I add more enums, the switch will get bigger. 😃

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [June 16, 2017, 5:47pm UTC](https://forums.unrealengine.com/t/blueprint-map-type-with-c-enum-key-and-default-values-causes-crash/391979/2 "2017-06-16T17:47:00Z")

</div>

Hi MilanRadeta,

Thank you for letting us know about this issue. I was able to reproduce the crash that you described in 4.15.3, but was unable to reproduce it in 4.16.1. I believe this has been corrected. Could you confirm that you are no longer seeing it in 4.16?

---

<div class="post-metadata">

**Author:** ![MilanRadeta](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MilanRadeta](https://forums.unrealengine.com/u/MilanRadeta)\
**Post date:** [June 19, 2017, 6:16am UTC](https://forums.unrealengine.com/t/blueprint-map-type-with-c-enum-key-and-default-values-causes-crash/391979/3 "2017-06-19T06:16:13Z")

</div>

Hi ,

I think this issue was corrected in 4.16, based on what I read in release notes. Also, I found a reported issue UE-42441, which looks like it’s fixed.

I haven’t tried to reproduce it yet (will do in a day or two), but if you say you can’t reproduce it, I guess that it’s definitely not a problem anymore. 🙂

Milan
