Browse Source

[enh] env: if good format is not respected display the error message…
…instead of adding first part.
- fix segfault in ft_search_pos_char if str == NULL.

Moul 4 years ago
parent
commit
923c42fb47
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/ft_search_pos_char.c

+ 3 - 1
src/ft_search_pos_char.c

@@ -6,7 +6,7 @@
 /*   By: mazimi <marvin@42.fr>                      +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2016/10/12 18:07:23 by mazimi            #+#    #+#             */
-/*   Updated: 2016/10/12 18:07:25 by mazimi           ###   ########.fr       */
+/*   Updated: 2016/10/29 14:42:41 by mazimi           ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -21,6 +21,8 @@ int		ft_search_pos_char(const char *s1, char c)
 {
 	int		i;
 
+	if (s1 == NULL)
+		return (-1);
 	i = -1;
 	while (s1[++i] != '\0')
 		if (s1[i] == c)