VSRonin / QtXlsxWriter

.xlsx file reader and writer for Qt5
http://qtxlsx.debao.me
209 stars 73 forks source link

NullPointer insertSheet with exceeding index fix #6

Closed CSendner closed 7 years ago

CSendner commented 7 years ago

Nullpointer with this sequence:

  1. Create new document
  2. Insert at exceeding index (i.e. 1 with a new document)
  3. Try to write to document
  4. Crash while writing, because internal structure has wrong index.
    QXlsx::Document xlsx(file_url);
    if(!xlsx.insertSheet(1, "records")){
        qDebug() << "Never here";
    }
    xlsx.write(1, 1, "id");//crash
    xlsx.save();
VSRonin commented 7 years ago

LGTM I'll give it a couple of days in case someone wants to object otherwise I'll merge