pakku icon indicating copy to clipboard operation
pakku copied to clipboard

Crash when searching and a package's description is empty

Open kajong0007 opened this issue 5 years ago • 0 comments

$ pakku -Ss steam-cli-
aur/steam-cli-git 0.r27.b7583dc-1 [0 / 0.000000]
fatal.nim(39)            sysFatal
Error: unhandled exception: index out of bounds, the container is empty [IndexError]
$ echo $?
1

This package in the AUR has a 0 length description. It causes pakku to crash here: https://github.com/kitsunyan/pakku/blob/master/src/format.nim#L152 I tested a change off of version 0.14 where I just didn't print anything if the description is empty:

  if len(description) > 0:
    let lines = description.get("").splitLines(getWindowSize().width - padding)
    for line in lines:
      echo(' '.repeat(padding), line)

output after change:

$ ./pakku -Ss steam-cli-
aur/steam-cli-git 0.r27.b7583dc-1 [0 / 0.000000]
$ echo $?
0 

I didn't do any searching for other areas where an empty string would cause issues, and as I don't know nim in the slightest, there is probably a more elegant solution.

kajong0007 avatar Dec 30 '19 05:12 kajong0007