[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesdk/kbabel
From:       Laurent Montel <montel () kde ! org>
Date:       2003-12-12 12:20:54
[Download RAW message or body]

CVS commit by mlaurent: 

Fix #70149 "kbabel crashes when opening empty file"


  M +35 -3     common/catalog.cpp   1.123
  M +84 -84    kbabel/kbabelview2.cpp   1.66


--- kdesdk/kbabel/common/catalog.cpp  #1.122:1.123
@@ -98,4 +98,6 @@ Catalog::~Catalog()
 QStringList Catalog::msgid(uint index, const bool noNewlines) const
 {
+   if (  d->_entries.isEmpty() )
+        return QString::null;
    uint max=d->_entries.count()-1;
    if(index > max)
@@ -107,4 +109,7 @@ QStringList Catalog::msgid(uint index, c
 QStringList Catalog::msgstr(uint index, const bool noNewlines) const
 {
+    if (  d->_entries.isEmpty() )
+        return QString::null;
+
    uint max=d->_entries.count()-1;
    if(index > max)
@@ -116,4 +121,6 @@ QStringList Catalog::msgstr(uint index, 
 QString Catalog::comment(uint index) const
 {
+    if (  d->_entries.isEmpty() )
+        return QString::null;
    uint max=d->_entries.count()-1;
    if(index > max)
@@ -169,4 +175,7 @@ int Catalog::indexForMsgid(const QString
 QStringList Catalog::tagList(uint index)
 {
+    if (  d->_entries.isEmpty() )
+        return QStringList();
+
    uint max=d->_entries.count()-1;
    if(index > max)
@@ -179,4 +188,7 @@ QStringList Catalog::tagList(uint index)
 QStringList Catalog::argList(uint index)
 {
+    if (  d->_entries.isEmpty() )
+        return QStringList();
+
    uint max=d->_entries.count()-1;
    if(index > max)
@@ -633,4 +645,7 @@ CatalogItem Catalog::updatedHeader(Catal
 void Catalog::setFuzzy(uint index, bool on)
 {
+    if (  d->_entries.isEmpty() )
+        return;
+
    uint max=d->_entries.count()-1;
    if(index > max)
@@ -1006,4 +1021,7 @@ void Catalog::removeFromErrorList(uint i
 QStringList Catalog::itemStatus(uint index, bool recheck, QPtrList<KDataTool> whatToCheck)
 {
+    if (  d->_entries.isEmpty() )
+        return QStringList();
+
         uint max=d->_entries.count()-1;
         if(index > max)
@@ -1025,4 +1043,7 @@ QStringList Catalog::itemStatus(uint ind
 QStringList Catalog::itemStatus(uint index)
 {
+       if (  d->_entries.isEmpty() )
+        return QStringList();
+
         uint max=d->_entries.count()-1;
         if(index > max)
@@ -1250,4 +1271,7 @@ bool Catalog::hasErrorAfterwards(uint in
 bool Catalog::isFuzzy(uint index) const
 {
+    if (  d->_entries.isEmpty() )
+        return false;
+
    if(index > numberOfEntries())
       return false;
@@ -1259,4 +1283,7 @@ bool Catalog::isFuzzy(uint index) const
 bool Catalog::isUntranslated(uint index) const
 {
+    if (  d->_entries.isEmpty() )
+        return false;
+
    if(index > numberOfEntries())
       return false;
@@ -1278,4 +1305,7 @@ bool Catalog::hasError(uint index, DocPo
 PluralFormType Catalog::pluralForm(uint index) const
 {
+    if (  d->_entries.isEmpty() )
+        return NoPluralForm;
+
     if(index > numberOfEntries())
         return NoPluralForm;
@@ -3477,4 +3507,6 @@ int Catalog::numberOfPluralForms( uint i
     if( index > numberOfEntries() ) return -1;
 
+    if (  d->_entries.isEmpty() )
+        return -1;
     if( d->_entries[index].pluralForm() == NoPluralForm ) return 1;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic