summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bmp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bmp.c b/bmp.c
index 7ee3750..5ca1594 100644
--- a/bmp.c
+++ b/bmp.c
@@ -91,10 +91,12 @@ bmp_write_pixel(bmp_write_handle_t* bmph, color_t col) {
return 0;
}
- if(--(bmph->line_left) == 0) {
- bmph->line_left = bmph->width;
-
- return (fwrite(padding, bmph->line_padding, 1, bmph->fh) == 1);
+ if(bmph->line_padding != 0) {
+ if(--(bmph->line_left) == 0) {
+ bmph->line_left = bmph->width;
+
+ return (fwrite(padding, bmph->line_padding, 1, bmph->fh) == 1);
+ }
}
return 1;