https://bugzilla.wikimedia.org/show_bug.cgi?id=50930

       Web browser: ---
            Bug ID: 50930
           Summary: zimlib file.h getArticle()
           Product: openZIM
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: zimlib
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

In zimlib (file.h), getArticle(size_type idx) is used to obtain the article
having ID ad idx.

However, when idx provided  is not found in any article in the ZIM file, the
function returns an article with the index as idx itself.

Similar functions, like getArticle(char ns, const std::string& url) does not
have this bug. If the required article is not found, they return an article
with index 4294967295.(maximum value of unsigned int).(in other words, the
default article, zim::Article(). )


I think getArticle(size_type idx) should also return zim::Article() instead of
a modified version.


Error reproduction code:

zim::File file (filename.zim);
std::cout<<"\n"<<file.getArticle(500).getIndex();   //Make sure the file has
less than 500 articles.

std::cout<<"\n"<<file.getArticle('X',"an_Article_which_doesn't_exist");

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to