Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

What is causing Tmap to crash the Editor?

For some reason I this function keeps crashing on line 36 with the error "Assertion failed: Pair != NULL". I'm not using pointers and I suspend the thread that uses PathQueue TMap.

 void FPathfindingWorker::AddNewPath(int32 Key, TArray<FVector> Nodes, FVector start, FVector finish)
     if (Thread)
         for (FVector Entry : Nodes)
             FString HashVector = Entry.ToCompactString();
             NodeData data;
             data.Location = Entry;
             data.bStart = false;
             data.bTarget = false;
             data.bClosed = false;
             data.bOpen = false;
             data.Fx = 0;
             data.Gx = 0;
             data.Hx = 0;
             data.Parent = Entry;
             CompleteList.Add(Key, false);
             if (finish.Equals(Entry))
                 data.bTarget = true;
             if (start.Equals(Entry))
                 data.bStart = true;
                 PathQueue[Key]["ClosedList"].Add(HashVector, data);
                 PathQueue[Key]["AllNodes"].Add(HashVector, data); // crash
             if (start.Equals(finish))
                 data.bClosed = true;
                 PathQueue[Key]["PathList"].Add(HashVector, data);
                 ProcessedPaths.Add(Key, PathQueue[Key]);
                 CompleteList[Key] = true;

Here is the declaration to PathQueue:

 TMap<int32, TMap<FString, TMap<FString, NodeData>>> PathQueue; 

I'm not sure if this is because of thread safety, unreal not supporting TMap inside TMaps, or something else.

Product Version: Not Selected
more ▼

asked May 25 '14 at 03:11 AM in C++ Programming

avatar image

58 4 8 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I recon this question is 2 years old. However the reason as to why this assertion fails hasn't changed to date (version 4.13.1 of the engine). It might help a fellow reader.

Anywho, this code simply crashes because one of the pairs the author tries to address here - particularly PathQueue[Key]["PathList"] - does not exist: either Key or "PathList".

Always ensure the pair exists by checking with, in this example, PathQueue.Contains(Key) and PathQueue[Key].Contains(FString(TEXT("PathList"))) (assuming PathQueue is a TMap<..., TMap>.

more ▼

answered Oct 25 '16 at 12:38 AM

avatar image

132 7 12 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Cause the function suspend is windows specific and unsafe. you have to enforce the use of it. wrap your code in the following includes and it will work

     #include "AllowWindowsPlatformTypes.h"
     // all your code that uses lowlevel threading should be here
     #include "HideWindowsPlatformTypes.h"

more ▼

answered Nov 11 '16 at 02:18 PM

avatar image

357 17 20 31

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question