Applying patch #5562
[pspp] / src / language / lexer / lexer.c
index 39b674c554d6891e037e43a97cc6d41b61a25f39..9c6063fd066b04f018e34e4a7f545058f56df3ef 100644 (file)
@@ -30,9 +30,9 @@
 #include <libpspp/assertion.h>
 #include <language/command.h>
 #include <libpspp/message.h>
-#include <language/line-buffer.h>
 #include <libpspp/magic.h>
 #include <data/settings.h>
+#include <libpspp/getl.h>
 #include <libpspp/str.h>
 
 #include "size_max.h"
@@ -111,11 +111,14 @@ lex_create (bool (*read_line_func) (struct string *, bool *))
 void
 lex_destroy (struct lexer *lexer)
 {
-  ds_destroy (&lexer->put_tokstr);
-  ds_destroy (&lexer->tokstr);
-  ds_destroy (&lexer->line_buffer);
+  if ( NULL != lexer ) 
+    {
+      ds_destroy (&lexer->put_tokstr);
+      ds_destroy (&lexer->tokstr);
+      ds_destroy (&lexer->line_buffer);
 
-  free (lexer);
+      free (lexer);
+    }
 }
 
 \f