std::string is a class that handles strings way better than char*. Basically you '#include <string>' to load the definitions and you can use it like so:
#include <string>
void printOutMyString( const std::string& string )
{
dbPrint( (char*)string.c_str() )
}
void someFunction()
{
std::string myString;
myString = "hello123"
myString += " plop"
printOutMyString( myString )
}
You can find more info on this at site such as
this, the way you use the string with dbPrint and such may look complex, but that's just because GDK is stupid, so you have to cast away the constness of the string, as well as returning the 'const char*' via .c_str().
The reason the delete[] operator is used in my function is because the GDK return strings are all allocated using new[], so they have to be deallocated somewhere, and it's easiest to do that in the function right after I copy the string over: 'output = raw;'.
Unless you have some very specific requirements, you should use std::string to store every single string in your game, this saves so much time and prevents so many potential issues. And all of your functions expecting strings should take the argument 'const std::string&' as shown above, this ensures the class itself is never copied as it's passed by reference, as such, it means the syntax is the same as passing it by value 'std::string'. Also, making it
const-correct makes it harder for the function taking the parameter to modify the value, which can be a very useful feature.
[edit] and to actually answer your question, using my function will ensure the returned string won't be NULL, thus you don't have to include any special code to handle that case.
[edit2] 'Textm = "";', this will effectively do nothing, textm is a pointer to an array of the type char(-128 to 127), and the line 'Textm = dbEntry();' will overwrite the pointer to the array, which can be NULL because dbEntry() can return this.