From dac5f20a0169a8b5f6e4fa983dac0ef572b0efed Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 6 Oct 2017 23:52:29 -0500 Subject: [PATCH] Patch SD file draw bug --- Marlin/ultralcd_impl_DOGM.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index 7cb30567bd..e9566df0d2 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -918,14 +918,15 @@ static void lcd_implementation_status_screen() { if (!PAGE_CONTAINS(row_y1, row_y2)) return; uint8_t n = LCD_WIDTH - (START_COL) - 1; + char c; if (longFilename[0]) { filename = longFilename; - longFilename[n] = '\0'; + longFilename[n] = '\0'; // cutoff at screen edge } if (isDir) lcd_print(LCD_STR_FOLDER[0]); - while (char c = *filename) { + while ((c = *filename) && n > 0) { n -= lcd_print_and_count(c); filename++; }