diff --git a/src/ConfigurationFile.cpp b/src/ConfigurationFile.cpp
index dd516595975bbb0157522cf309412e867c5fc8a5..9e9cd234f1096a216ca018feeb519a7e0fddeb4f 100644
--- a/src/ConfigurationFile.cpp
+++ b/src/ConfigurationFile.cpp
@@ -73,7 +73,7 @@ char* ConfigurationFile::getLine() throw(PacketExceptionIO*)
     try
     {
         temp = InputTextFile::getLine();
-        if(temp[0] == 0)
+        if(temp == 0 || temp[0] == 0)
         	return temp;
         while(strstr(temp, "--") !=  NULL)
         {
diff --git a/src/Packet.cpp b/src/Packet.cpp
index 139d510ba415412bb84b067d15cc4f9e3d9660ae..ec05ee78908eead6f8b806c2592e1b469e03197c 100644
--- a/src/Packet.cpp
+++ b/src/Packet.cpp
@@ -254,7 +254,7 @@ bool Packet::createPacketType(char* fileName, bool isprefix, word dimprefix) thr
 												{
 													dimPacketTail = dataField->getPacketTail()->size();
 													line = file.getLastLineRead();
-													if(strcmp(line, "[Compression]") == 0) {
+													if(line && strcmp(line, "[Compression]") == 0) {
 														compressible = true;
 														compressionAlgorithmsIndex = atoi(file.getLine());
 														compressionAlgorithmsSection = atoi(file.getLine());
diff --git a/src/PartOfPacket.cpp b/src/PartOfPacket.cpp
index ef09237d7f5531801c2d09c34ce1b7c4a6f10a01..588851862207e2c47d381c1c0890d99d7ca3fe5f 100644
--- a/src/PartOfPacket.cpp
+++ b/src/PartOfPacket.cpp
@@ -247,7 +247,7 @@ bool PartOfPacket::loadFields(InputText& fp) throw(PacketException*)
     do {
         name = fp.getLine();
         count++;
-        if(name[0] == '[')
+        if(fp.isEOF() || name[0] == '[')
         {
             count--;
             break;
@@ -273,7 +273,7 @@ bool PartOfPacket::loadFields(InputText& fp) throw(PacketException*)
         numberOfFields++;
         name = fp.getLine();
         /// It reads until the buffer ends
-        if(name[0] == '[')
+        if(fp.isEOF() || name[0] == '[')
         {
             break;
         }