desktop / registry-js

A simple and opinionated library for working with the Windows registry
MIT License
154 stars 47 forks source link

Undefined elements returned from enumerateValues #208

Open trew opened 3 years ago

trew commented 3 years ago

https://github.com/desktop/registry-js/blob/master/src/main.cc#L109 This line allocates an array of fixed size, which is then populated with values on these lines: https://github.com/desktop/registry-js/blob/master/src/main.cc#L133:L149

Only REG_SZ, REG_EXPAND_SZ and REG_DWORD is supported.

If an unsupported value is enumerated, this produces an array in typescript that could end up looking like this:

[{ ... REG_DWORD value }, undefined, { ...REG_SZ value }]

The typings does not reflect that undefined is a possibility. Either the typings should change, or the array returned from the EnumerateValues function should not return empty values.