summaryrefslogtreecommitdiffstats
path: root/utils/segment/ngseg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/segment/ngseg.cpp')
-rw-r--r--utils/segment/ngseg.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/segment/ngseg.cpp b/utils/segment/ngseg.cpp
index c4853df..1e3f6c5 100644
--- a/utils/segment/ngseg.cpp
+++ b/utils/segment/ngseg.cpp
@@ -138,7 +138,9 @@ int main(int argc, char * argv[]){
size_t size = 0;
ssize_t read;
while( (read = getline(&linebuf, &size, stdin)) != -1 ){
- linebuf[strlen(linebuf) - 1] = '\0';
+ if ( '\n' == linebuf[strlen(linebuf) - 1] ) {
+ linebuf[strlen(linebuf) - 1] = '\0';
+ }
//check non-ucs2 characters
const glong num_of_chars = g_utf8_strlen(linebuf, -1);