changeset 3433:8519aba2644d

Patch by artur Zaprzala: This patch adds test for NULL return value of strchr().
author atmos4
date Mon, 10 Dec 2001 14:48:02 +0000
parents 5cb7caab5536
children c85a4768627c
files subreader.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/subreader.c	Mon Dec 10 14:41:44 2001 +0000
+++ b/subreader.c	Mon Dec 10 14:48:02 2001 +0000
@@ -273,8 +273,14 @@
  		p=line;	
  		// finds the body of the subtitle
  		for (i=0; i<3; i++){              
-                   p=strchr(p,':')+1;
-                 } 
+		   p=strchr(p,':');
+		   if (p==NULL) break;
+		   ++p;
+		} 
+		if (p==NULL) {
+		    printf("SUB: Skipping incorrect subtitle line!\n");
+		    continue;
+		}
  		i=0;
 
 		if (*p!='|') {