@@ -67,23 +67,23 @@ namespace Sass {
67
67
}
68
68
69
69
// now create the code trace (ToDo: maybe have util functions?)
70
- if (e.pstate .line != std::string::npos && e.pstate .column != std::string::npos) {
70
+ if (e.pstate .line != std::string::npos &&
71
+ e.pstate .column != std::string::npos &&
72
+ e.pstate .src != nullptr ) {
71
73
size_t lines = e.pstate .line ;
72
- const char * line_beg = e.pstate .src ;
73
74
// scan through src until target line
74
75
// move line_beg pointer to line start
75
- while (line_beg && *line_beg && lines != 0 ) {
76
+ const char * line_beg;
77
+ for (line_beg = e.pstate .src ; *line_beg != ' \0 ' ; ++line_beg) {
78
+ if (lines == 0 ) break ;
76
79
if (*line_beg == ' \n ' ) --lines;
77
- utf8::unchecked::next (line_beg);
78
80
}
79
- const char * line_end = line_beg;
80
81
// move line_end before next newline character
81
- while (line_end && *line_end && *line_end != ' \n ' ) {
82
- if (*line_end == ' \n ' ) break ;
83
- if (*line_end == ' \r ' ) break ;
84
- utf8::unchecked::next (line_end);
82
+ const char * line_end;
83
+ for (line_end = line_beg; *line_end != ' \0 ' ; ++line_end) {
84
+ if (*line_end == ' \n ' || *line_end == ' \r ' ) break ;
85
85
}
86
- if (line_end && *line_end != 0 ) ++ line_end;
86
+ if (*line_end != ' \0 ' ) ++line_end;
87
87
size_t line_len = line_end - line_beg;
88
88
size_t move_in = 0 ; size_t shorten = 0 ;
89
89
size_t left_chars = 42 ; size_t max_chars = 76 ;
0 commit comments