From 516f7b98a13ebae2271d0a141378ee074f93c42d Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Mon, 25 Jun 2012 18:41:44 +0200
Subject: [PATCH] BUG: wrong condition for field creation

---
 Applications/Segmentation/otbSegmentation.cxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Applications/Segmentation/otbSegmentation.cxx b/Applications/Segmentation/otbSegmentation.cxx
index c03a82cfff..68409b12f9 100644
--- a/Applications/Segmentation/otbSegmentation.cxx
+++ b/Applications/Segmentation/otbSegmentation.cxx
@@ -495,7 +495,8 @@ private:
         // And create the field if necessary
         std::string fieldName = this->GetParameterString("mode.vector.fieldname");
         OGRFeatureDefn & ogrFeatureDfn = layer.GetLayerDefn();
-        if (-1 != ogrFeatureDfn.GetFieldIndex(fieldName.c_str()))
+
+        if (-1 == ogrFeatureDfn.GetFieldIndex(fieldName.c_str()))
           {
           OGRFieldDefn field(fieldName.c_str(),OFTInteger);
           layer.CreateField(field,true);
-- 
GitLab