Return-statement with no value
Hello!
I am facing a problem.
I want to use the conten of a file bt I have to check first if the file is opened.
I am receiving th efollowing error message: "return-statement with no value, in function returning 'QStringList"
My question: How to stop the process if the file can not be opened, since "return-statement does not work here?
break-statement can be used only in a loop.
Here is my code.
Code:
{
{
QMessageBox::critical(this,
"Warning",
"Open a file please");
return;
}
// I do something here
}
Many thanks in advance.
Re: Return-statement with no value
Your method has a return type of QStringList, so all exits from it must return a QStringList object.
Cheers,
_
Re: Return-statement with no value
Many thanks!!!
I have gone the half of the way.
I have avoided willingly to indicate the path to the file after returning an empty QStringList, and the program crashes. Is there any way to ovoid this problem?
Many thanks in advance.
Added after 22 minutes:
Many thanks one more time. I can mark this subjet as resolved. The crashing problem was in the function calling the open() function.
Many thanks!