aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/wslua/wslua_file.c')
-rw-r--r--epan/wslua/wslua_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c
index 79bf4f7a3d..73bacc6c99 100644
--- a/epan/wslua/wslua_file.c
+++ b/epan/wslua/wslua_file.c
@@ -192,7 +192,7 @@ static int File_read_line(lua_State *L, FILE_T ft) {
length = (gint)(file_tell(ft) - pos_before);
/* ...but don't want to include newline in line length */
- if (linebuff[length-1] == '\n') {
+ if (length > 0 && linebuff[length-1] == '\n') {
length--;
/* Nor do we want '\r' (as will be written when log is created on windows) */
if (length > 0 && linebuff[length - 1] == '\r') {