term.h: Avoid returining 0-sized terminal as it may lead to division by zero.

This commit is contained in:
Vladimir Serbinenko 2015-01-20 17:55:41 +01:00
parent 475bffeae6
commit 1b6aaddc45
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/term.h: Avoid returining 0-sized terminal
as it may lead to division by zero.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/zfs.c: Avoid divisions by zero.

View file

@ -334,12 +334,12 @@ void grub_term_restore_pos (struct grub_term_coordinate *pos);
static inline unsigned grub_term_width (struct grub_term_output *term)
{
return term->getwh(term).x;
return term->getwh(term).x ? : 80;
}
static inline unsigned grub_term_height (struct grub_term_output *term)
{
return term->getwh(term).y;
return term->getwh(term).y ? : 24;
}
static inline struct grub_term_coordinate