I have a vector not (QVector) of pointers to a struct. I am reusing the same window in my project and just clearing the vector and re-populating it when the data changes. The program keeps crashing when I initially try to run the program though, and it's because I am trying to clear a vector that has had nothing done it to. I call the same function when I load new data, and this function wants to clear the vector. I figured there was no harm clearing a vector I hadn't used but apparently this is not so.

So is there a way to have a vector declared in my .h file, and skip clearing it the first time through, but then clear it after that? Even if I try to check it's size to see if it's greater than 0, it crashes. Thanks for your help.