C++为什么小弟我的代码一直运行异常啊求大神帮小弟我看看

C++为什么我的代码一直运行错误啊求大神帮我看看
我知道问题大概出在!(*it).empty() && 但是我不知道为啥错了编译没问题一运行 就出错
it是vector<string>的迭代器 ,it dereference 取出string的对象调用empty()检验此行是否为空,空行跳出
哪里有问题呢?麻烦帮我看下吧








#include<iostream>
#include<vector>
#include<string>
using namespace std;
void main()
{
vector<string> text;
string word;
while (cin >> word)text.push_back(word);
for (auto it = text.begin();
!(*it).empty() && it != text.end(); it++)
{
for (auto itr = (*it).begin(); itr != (*it).end(); itr++)
*itr = toupper(*itr);
}
for (auto it = text.begin(); it != text.end(); ++it)
cout << *it << endl;

}
------解决思路----------------------
判断顺序倒换一下再试试。

it != text.end() && !(*it).empty()