aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/Windows/Registry.hs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/Windows/Registry.hs b/src/Windows/Registry.hs
index 41275bf..9423205 100644
--- a/src/Windows/Registry.hs
+++ b/src/Windows/Registry.hs
@@ -133,8 +133,7 @@ decodeString (_, bytes) = T.unpack dropLastZero
where
text = decodeUtf16LE bytes
dropLastZero | T.null text = text
- | T.last text == '\0' = T.init text
- | otherwise = text
+ | otherwise = T.dropWhileEnd (== '\0') text
openCloseCatch :: IsKeyPath a => a -> (Handle -> IO b) -> ExceptT IOError IO b
openCloseCatch keyPath f = ExceptT $ catchIOError (openApplyClose >>= return . Right) $ return . Left