alexjlockwood / avocado

🥑 Vector Drawable optimization tool 🥑
MIT License
1.35k stars 48 forks source link

This svg makes the command crash #23

Closed FrancoisBlavoet closed 6 years ago

FrancoisBlavoet commented 6 years ago

Hi,

I have been testing avdo, thanks for making this tool, it should be pretty useful !

However this vd makes it crash :

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:width="24dp"
        android:height="24dp">
    <group
        android:translateX="-168"
        android:translateY="-484">
        <group
            android:translateX="16"
            android:translateY="472">
            <group
                android:translateX="111"
                android:translateY="12">
                <group
                    android:translateX="41">
                    <path
                        android:pathData="M0.85714286 0L23.142857 0C23.616244 0 24 0.38375593 24 0.85714286L24 23.142857C24 23.616244 23.616244 24 23.142857 24L0.85714286 24C0.38375593 24 0 23.616244 0 23.142857L0 0.85714286C0 0.38375593 0.38375593 0 0.85714286 0Z"
                        android:fillColor="#43b02a" />
                    <path
                        android:pathData="M22.268041 22.268041l0 -20.5360822 -20.5360822 0 0 20.5360822z"
                        android:fillColor="#ffffff" />
                    <path
                        android:pathData="M8.5150571 11.876289l5.1493549 5.195876 2.574678 -2.597938 6.577198 8.111423c0.300145 0.370158 0.246075 0.915745 -0.120769 1.218602C22.542186 23.930839 22.350172 24 22.152058 24L1.6004939 24c-0.4739851 0 -0.85822586 -0.387712 -0.85822586 -0.865979 0 -0.18049 0.0558904 -0.35647 0.15985875 -0.503341L8.5150571 11.876289Z"
                        android:fillColor="#43b02a" />
                    <path
                        android:pathData="M3.2164949 22.268041l17.0721651 0 -4.22917 -5.181236 -2.447161 2.452961 -4.9301432 -4.941828z"
                        android:fillColor="#ffffff" />
                    <path
                        android:pathData="M17.072165 10.391753c-1.913069 0 -3.463918 -1.5508491 -3.463918 -3.463918 0 -1.9130688 1.550849 -3.4639175 3.463918 -3.4639175 1.913069 0 3.463917 1.5508487 3.463917 3.4639175 0 1.9130689 -1.550848 3.463918 -3.463917 3.463918z"
                        android:fillColor="#43b02a" />
                    <path
                        android:pathData="M17.072165 8.6597938c0.956534 0 1.731959 -0.7754243 1.731959 -1.7319588 0 -0.9565344 -0.775425 -1.7319587 -1.731959 -1.7319587 -0.956534 0 -1.731959 0.7754243 -1.731959 1.7319587 0 0.9565345 0.775425 1.7319588 1.731959 1.7319588z"
                        android:fillColor="#ffffff" />
                </group>
            </group>
        </group>
    </group>
</vector>

exception :

TypeError: Cannot read property 'length' of undefined
    at strongRound (/usr/local/lib/node_modules/avdo/dist/plugins/bakeGroupTransforms.js:20:26)
    at /usr/local/lib/node_modules/avdo/dist/plugins/bakeGroupTransforms.js:68:48
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/avdo/dist/plugins/bakeGroupTransforms.js:68:18
    at Array.forEach (<anonymous>)
    at fn (/usr/local/lib/node_modules/avdo/dist/plugins/bakeGroupTransforms.js:39:18)
    at /usr/local/lib/node_modules/avdo/dist/plugins/_plugins.js:30:32
    at Array.filter (<anonymous>)
    at recurseFn (/usr/local/lib/node_modules/avdo/dist/plugins/_plugins.js:23:37)
    at /usr/local/lib/node_modules/avdo/dist/plugins/_plugins.js:35:17
alexjlockwood commented 6 years ago

Thanks for the report!

What is the output of avdo -V? Just want to confirm the version.

alexjlockwood commented 6 years ago

I don't get this crash using version 0.1.4. Maybe you have an older version installed? I think I fixed this bug about a month ago. :)

FrancoisBlavoet commented 6 years ago

Arg, indeed I should have updated before reporting, nevermind