It seems like the original code tried to prevent this (h,s values getting set to zero with low v values), but because of floats, v never became exactly zero or less.
During my tests it seems like the change in s value happened when v took on a value of 4.86969043e-09
I've tested this by putting in values in the UI color wheel. It seems to work fine now.