# HG changeset patch # User Michael Schloh von Bennewitz # Date 1229350597 -3600 # Node ID 579d467531ccd4877a6ddcf2b7045f4854705a90 # Parent 0647b688d973669a19c820054a57156f506b7488 Correct NULL pointer dereference error in a exception safe manner. diff -r 0647b688d973 -r 579d467531cc as_dataop.cpp --- a/as_dataop.cpp Mon Dec 15 12:46:00 2008 +0100 +++ b/as_dataop.cpp Mon Dec 15 15:16:37 2008 +0100 @@ -455,25 +455,25 @@ const bool Titraqform::validateData(QFile &Filin) const { QString Firstline; // Will contain the first line of text - char *pReadline; // Contains the read line of text file + char szReadline[QString(TITRAQ_DATAPATTERN).length() + 4L]; // File line bool bRet = false; // Set the initial return value if (Filin.isOpen()) { // Check open state of file Filin.flush(); // Not sure if this is needed Filin.reset(); // Set the file index position to 0 - Filin.readLine(pReadline, QString(TITRAQ_DATAPATTERN).length() + 2L); + Filin.readLine(szReadline, QString(TITRAQ_DATAPATTERN).length() + 2L); } else { if (!Filin.open(QIODevice::ReadOnly)) // Try to open file throw Genexcept(trUtf8(TITRAQ_READPFILFAIL)); else { // File is now open - Filin.readLine(pReadline, QString(TITRAQ_DATAPATTERN).length() + 2L); + Filin.readLine(szReadline, QString(TITRAQ_DATAPATTERN).length() + 2L); Filin.close(); // Remember to close } } try { // Pass off to worker method - Firstline = QString::fromAscii(pReadline); + Firstline = QString::fromAscii(szReadline); bRet = this->validateData(Firstline); } catch (Genexcept &) {