x

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"

Access violation reading location TArray.Empty()

Hi guys, Im not sure what is going on here. I have been following the Shooter Example project to try and get some multiplayer functionality and i'm in the process of writing the server browser widget but when i call Empty() on the array of list items, i get an access violation saying:

First-chance exception at 0x00007FF75582CE19 in RTS-Win64-DebugGame.exe: 0xC0000005: Access violation reading location 0x0000000000000008. Unhandled exception at 0x00007FF75582CE19 in RTS-Win64-DebugGame.exe: 0xC0000005: Access violation reading location 0x0000000000000008.

I dont understand what i am doing wrong here because this is called as soon as the menu is brought up, so there aren't even any items there. I have already tried making the array a uproperty as the array is of shared pointers and that had no effect.

Any help with this would be greatly appreciated.

Kieran.

Product Version: Not Selected
Tags:
more ▼

asked Apr 19 '15 at 09:54 PM in C++ Programming

avatar image

KieranChandler
128 10 17 20

avatar image BaderThanBad Apr 20 '15 at 08:39 AM

If you post your setup it'd help.

I assume it is either the array is private and you are accessing it outside member functions, or perhaps the object that contains the array is actually null and you are calling functions on it.

avatar image KieranChandler Apr 20 '15 at 12:35 PM

I am calling it from within the class it belongs to so i dont think its that. Also surely if the server browser object is null the function would not be called at all right?

http://gyazo.com/ba832fb0c0a919fbfba514fea2dad0f1 http://gyazo.com/b01519cce04471409e71a9bb375fea3f

avatar image BaderThanBad Apr 20 '15 at 05:11 PM

I am not familiar with the shooter example or what you are trying to do so someone else might have a better idea, but in general the access violation you are getting is either from the class itself being null (the function would indeed be called on a null object and it would crash as soon as it tries to access any member variables/functions like what is happening), or you are doing operations on invalid/null objects inside the array, or you are going out of bounds of the array.

avatar image KieranChandler Apr 20 '15 at 09:57 PM

Okay so ive done a little more debugging and ive found that even when i replace the ServerList.Empty(); with: http://gyazo.com/57342dbdf3881171e575a7e4ae3b7fdd It still gives the error. Its not actually breaking on the call itself but on this: http://gyazo.com/57342dbdf3881171e575a7e4ae3b7fdd

In both cases it breaks on DestructItems, which i think suggests that it thinks there are items in the array which there are not. when i call Empty or initialize the array in the constructor it works but out of the constructor it doesn't

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

1 answer: sort voted first

I Have fixed the problem now. I believe it was something along the lines of what BaderThanBad was saying. I was calling the BeginServerSearch function when the widget was enabled. To fix it i called the function when a button was pressed.

Thank you for your help BaderThanBad

more ▼

answered Apr 20 '15 at 10:08 PM

avatar image

KieranChandler
128 10 17 20

(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