GH #416: PDF::Page::createTextAnnotation bad comparison

This commit is contained in:
Alex Fabijanic
2014-04-29 22:03:52 -05:00
parent 8a9e7792d9
commit 9553d1d2ec
2 changed files with 7 additions and 7 deletions

View File

@@ -170,9 +170,9 @@ const Font& Document::loadFont(const std::string& name, const std::string& encod
const Font& Document::font(const std::string& name, const std::string& encoding) const Font& Document::font(const std::string& name, const std::string& encoding)
{ {
FontContainer::iterator it = _fonts.find(name); FontContainer::iterator it = _fonts.find(name);
if (_fonts.end() == it) return loadFont(name, encoding); if (_fonts.end() != it) return it->second;
throw IllegalStateException("Could not create font."); return loadFont(name, encoding);
} }

View File

@@ -131,7 +131,7 @@ void Page::setRotation(int angle)
const Destination& Page::createDestination(const std::string& name) const Destination& Page::createDestination(const std::string& name)
{ {
DestinationContainer::iterator it = _destinations.find(name); DestinationContainer::iterator it = _destinations.find(name);
if (_destinations.end() == it) if (_destinations.end() != it)
throw InvalidArgumentException("Destination already exists."); throw InvalidArgumentException("Destination already exists.");
Destination dest(_pPDF, HPDF_Page_CreateDestination(_page), name); Destination dest(_pPDF, HPDF_Page_CreateDestination(_page), name);
@@ -150,7 +150,7 @@ const TextAnnotation& Page::createTextAnnotation(const std::string& name,
const Encoder& encoder) const Encoder& encoder)
{ {
TextAnnotationContainer::iterator it = _textAnnotations.find(name); TextAnnotationContainer::iterator it = _textAnnotations.find(name);
if (_textAnnotations.end() == it) if (_textAnnotations.end() != it)
throw InvalidArgumentException("Annotation already exists."); throw InvalidArgumentException("Annotation already exists.");
TextAnnotation ann(_pPDF, TextAnnotation ann(_pPDF,
@@ -171,7 +171,7 @@ const LinkAnnotation& Page::createLinkAnnotation(const std::string& name,
const Destination& dest) const Destination& dest)
{ {
LinkAnnotationContainer::iterator it = _linkAnnotations.find(name); LinkAnnotationContainer::iterator it = _linkAnnotations.find(name);
if (_linkAnnotations.end() == it) if (_linkAnnotations.end() != it)
throw InvalidArgumentException("Annotation already exists."); throw InvalidArgumentException("Annotation already exists.");
LinkAnnotation ann(_pPDF, LinkAnnotation ann(_pPDF,
@@ -191,7 +191,7 @@ const LinkAnnotation& Page::createURILinkAnnotation(const std::string& name,
const std::string& uri) const std::string& uri)
{ {
LinkAnnotationContainer::iterator it = _linkAnnotations.find(name); LinkAnnotationContainer::iterator it = _linkAnnotations.find(name);
if (_linkAnnotations.end() == it) if (_linkAnnotations.end() != it)
throw InvalidArgumentException("Annotation already exists."); throw InvalidArgumentException("Annotation already exists.");
LinkAnnotation ann(_pPDF, LinkAnnotation ann(_pPDF,