Fix zstd process
diff --git a/lib/zip_algorithm_zstd.c b/lib/zip_algorithm_zstd.c
index 0c6c3da..1bd25d4 100644
--- a/lib/zip_algorithm_zstd.c
+++ b/lib/zip_algorithm_zstd.c
@@ -181,13 +181,13 @@
 	zip_error_set(ctx->error, ZIP_ER_ZSTD, (int)ret);
 	return ZIP_COMPRESSION_ERROR;
     }
+    *length = ctx->out.pos;
     if (ctx->out.pos == 0) {
 	return ZIP_COMPRESSION_NEED_DATA;
     }
     if (ctx->in.size == 0) {
 	return ZIP_COMPRESSION_END;
     }
-    *length = ctx->out.pos;
     return ZIP_COMPRESSION_OK;
 }