diff --git a/plugins/convertPathData.js b/plugins/convertPathData.js
index 3ba5288fe..8d573ee38 100644
--- a/plugins/convertPathData.js
+++ b/plugins/convertPathData.js
@@ -394,7 +394,6 @@ function filters(
path = path.filter(function (item, index, path) {
const qControlPoint = prevQControlPoint;
- prevQControlPoint = undefined;
let command = item.command;
let data = item.args;
@@ -895,6 +894,8 @@ function filters(
// @ts-ignore
prevQControlPoint = item.coords;
}
+ } else {
+ prevQControlPoint = undefined;
}
prev = item;
return true;
diff --git a/test/plugins/convertPathData.36.svg.txt b/test/plugins/convertPathData.36.svg.txt
new file mode 100644
index 000000000..69f35de57
--- /dev/null
+++ b/test/plugins/convertPathData.36.svg.txt
@@ -0,0 +1,15 @@
+Should process/optimize q correctly even if useless commands in between.
+
+See: https://github.com/svg/svgo/issues/1926
+
+===
+
+
+
+@@@
+
+