author | eilers <eilers> | 2004-11-06 19:41:22 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-11-06 19:41:22 (UTC) |
commit | 82023570a9b5880629a5f7ce477479ffcb7af930 (patch) (unidiff) | |
tree | df2e790812950d2a2cc32af3e39cc8d293133259 /noncore/apps/opie-sheet/Excel.cpp | |
parent | 90d458c63d274a66ca427710b88e2f090a0ab11b (diff) | |
download | opie-82023570a9b5880629a5f7ce477479ffcb7af930.zip opie-82023570a9b5880629a5f7ce477479ffcb7af930.tar.gz opie-82023570a9b5880629a5f7ce477479ffcb7af930.tar.bz2 |
Avoid crash if app was unable to open the file
Diffstat (limited to 'noncore/apps/opie-sheet/Excel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/Excel.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/apps/opie-sheet/Excel.cpp b/noncore/apps/opie-sheet/Excel.cpp index 57aef20..338bc30 100644 --- a/noncore/apps/opie-sheet/Excel.cpp +++ b/noncore/apps/opie-sheet/Excel.cpp | |||
@@ -568,49 +568,50 @@ void ExcelBook::ParseSheets(void) | |||
568 | default: | 568 | default: |
569 | break; | 569 | break; |
570 | }; | 570 | }; |
571 | }; | 571 | }; |
572 | }; | 572 | }; |
573 | 573 | ||
574 | void ExcelBook::GetSheets(void) | 574 | void ExcelBook::GetSheets(void) |
575 | { | 575 | { |
576 | ExcelSheet* sheet; | 576 | ExcelSheet* sheet; |
577 | Sheets.resize(0); | 577 | Sheets.resize(0); |
578 | sheet=GetSheet(); | 578 | sheet=GetSheet(); |
579 | while (sheet->Cells.count()!= 0 ) | 579 | while (sheet->Cells.count()!= 0 ) |
580 | { | 580 | { |
581 | Sheets.resize(Sheets.count()+1); | 581 | Sheets.resize(Sheets.count()+1); |
582 | Sheets[Sheets.count()-1]=sheet; | 582 | Sheets[Sheets.count()-1]=sheet; |
583 | sheet->name=*Names[Sheets.count()-1]; | 583 | sheet->name=*Names[Sheets.count()-1]; |
584 | sheet=GetSheet(); | 584 | sheet=GetSheet(); |
585 | }; | 585 | }; |
586 | }; | 586 | }; |
587 | 587 | ||
588 | bool ExcelBook::ParseBook(char *file) | 588 | bool ExcelBook::ParseBook(char *file) |
589 | { | 589 | { |
590 | dateformat=QString(""); | 590 | dateformat=QString(""); |
591 | DetectEndian(); | 591 | DetectEndian(); |
592 | OpenFile(file); | 592 | if ( !OpenFile( file ) ) |
593 | return false; | ||
593 | SeekBOF(); | 594 | SeekBOF(); |
594 | ParseSheets(); | 595 | ParseSheets(); |
595 | GetSheets(); | 596 | GetSheets(); |
596 | return true; | 597 | return true; |
597 | }; | 598 | }; |
598 | 599 | ||
599 | QString ExcelBook::GetASCII(char* inbytes, int pos, int chars) | 600 | QString ExcelBook::GetASCII(char* inbytes, int pos, int chars) |
600 | { | 601 | { |
601 | int i; | 602 | int i; |
602 | QString outstr=""; | 603 | QString outstr=""; |
603 | for (i = 0; i < chars; i++) | 604 | for (i = 0; i < chars; i++) |
604 | { | 605 | { |
605 | outstr.append(inbytes[i+pos]); | 606 | outstr.append(inbytes[i+pos]); |
606 | }; | 607 | }; |
607 | return outstr; | 608 | return outstr; |
608 | }; | 609 | }; |
609 | 610 | ||
610 | QString ExcelBook::GetUnicode(char * inbytes, int pos, int chars) | 611 | QString ExcelBook::GetUnicode(char * inbytes, int pos, int chars) |
611 | { | 612 | { |
612 | QString outstr=""; | 613 | QString outstr=""; |
613 | int i; | 614 | int i; |
614 | int rc; | 615 | int rc; |
615 | for (i=0; i<chars*2; i++) | 616 | for (i=0; i<chars*2; i++) |
616 | { | 617 | { |