diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/boxvec.c | 2 | ||||
-rw-r--r-- | src/wrap.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/boxvec.c b/src/boxvec.c index 7cdd01c..f00a81c 100644 --- a/src/boxvec.c +++ b/src/boxvec.c @@ -85,6 +85,8 @@ struct wrap_box *bv_box(struct boxvec *vec, int i) struct wrap_box *bv_last(struct boxvec *vec) { + if ( vec == NULL ) return NULL; + if ( vec->boxes == NULL ) return NULL; return vec->boxes[vec->n_boxes-1]; } @@ -960,7 +960,9 @@ int wrap_contents(struct frame *fr) //distribute_spaces(line, wrap_w, rho); /* Strip any sentinel boxes added by the wrapping algorithm */ - if ( bv_last(line->boxes)->type == WRAP_BOX_SENTINEL ) { + if ( (bv_last(line->boxes) != NULL) + && (bv_last(line->boxes)->type == WRAP_BOX_SENTINEL) ) + { line->boxes->n_boxes--; } |