Skip to content

Commit a041114

Browse files
committed
Fix crash on decompress output when reading from stdin.
1 parent 92f8fad commit a041114

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/plz4/internal/ops/decompress.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,18 @@ func _decompress(rdwr *targetT, opts ...plz4.OptT) error {
107107

108108
percent := float64(rcnt.cnt) / float64(n) * 100.0
109109

110+
input := strStdin
111+
if rdwr.src != nil {
112+
input = rdwr.src.Name()
113+
}
114+
110115
t := table.NewWriter()
111116
t.SetTitle("Decompress results")
112117
t.SetStyle(table.StyleColoredBright)
113118
t.SetOutputMirror(os.Stdout)
114119
t.AppendHeader(table.Row{"Key", "Value"})
115120
t.AppendRows([]table.Row{
116-
{"Input", rdwr.src.Name()},
121+
{"Input", input},
117122
{"Output", rdwr.dst.Name()},
118123
{"InSize", rcnt.cnt},
119124
{"OutSize", n},

0 commit comments

Comments
 (0)