avoid an unneeded EXTEND() call when the FT2 has_chars() implementation returns 0.
[imager.git] / FT2 / FT2.xs
index dd93442..e1c4de4 100644 (file)
@@ -243,10 +243,12 @@ i_ft2_has_chars(handle, text_sv, utf8)
         work = mymalloc(len);
         count = i_ft2_has_chars(handle, text, len, utf8, work);
         if (GIMME_V == G_ARRAY) {
-          EXTEND(SP, count);
-          for (i = 0; i < count; ++i) {
-            PUSHs(boolSV(work[i]));
-          }
+         if (count) {
+            EXTEND(SP, count);
+            for (i = 0; i < count; ++i) {
+              PUSHs(boolSV(work[i]));
+            }
+         }
         }
         else {
           EXTEND(SP, 1);