<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Perfect Nathan, thanks a lot.<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 04/03/2013 07:44 AM, Nathan Woodrow
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAAi8Yg81OZiZSRHpvmPwt9ymaQ1x82kznEkzg-3YTE4yBf62ag@mail.gmail.com"
      type="cite">
      <div dir="ltr">Denis,
        <div><br>
        </div>
        <div style="">You didn't tell QgsFeature how many attributes it
          has.  You can call initAttributes(1) or pass in the QgsFields
          into QgsFeature(fields)</div>
        <div style=""><br>
        </div>
        <div style="">
          - Nathan</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Wed, Apr 3, 2013 at 3:42 PM, Denis
          Rouzaud <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
            <br>
            I try to add a feature in a layer with only one field (over
            a few in the layer) filled.<br>
            <br>
            Here is what I tried:<br>
            <br>
            f = QgsFeature()<br>
            f.setGeometry(myGeom)<br>
            f.setAttribute(1, myValue)<br>
            provider.addFeatures( [f] )<br>
            <br>
            This causes QGIS to crash.<br>
            <br>
            What did I wrong? I should not set field 1 if there is a
            field 0 in my feature?<br>
            Should I set the same number of fields as present in the
            layer?<br>
            Is there another way to achieve this?<br>
            <br>
            Thanks a lot,<br>
            <br>
            Denis<br>
            <br>
            <br>
            <br>
            <br>
            _______________________________________________<br>
            Qgis-developer mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Qgis-developer@lists.osgeo.org"
              target="_blank">Qgis-developer@lists.osgeo.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.osgeo.org/mailman/listinfo/qgis-developer"
              target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>