terminal/command: stack command panics when stack has 1 frame

Insure that the digits function always returns at least 1.

Fixes #354 (partial)
This commit is contained in:
aarzilli
2016-01-27 13:33:37 +01:00
parent 6c7ad4059b
commit b94e2bd0ec
2 changed files with 9 additions and 0 deletions

View File

@ -819,6 +819,9 @@ func (c *Commands) sourceCommand(t *Term, args string) error {
}
func digits(n int) int {
if n <= 0 {
return 1
}
return int(math.Floor(math.Log10(float64(n)))) + 1
}