Fixed incorrect handling of the case where an invalid DTSC file has a valid DTSH file. Now correctly cancels reading, while previously threw up a whole bunch of error vomit. Yay.
This commit is contained in:
		
							parent
							
								
									5792097cc4
								
							
						
					
					
						commit
						cc6946c95b
					
				
					 1 changed files with 5 additions and 12 deletions
				
			
		
							
								
								
									
										17
									
								
								lib/dtsc.cpp
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								lib/dtsc.cpp
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -608,18 +608,11 @@ DTSC::File::File(std::string filename, bool create) {
 | 
			
		|||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    if (memcmp(buffer, DTSC::Magic_Header, 4) != 0) {
 | 
			
		||||
      if (memcmp(buffer, DTSC::Magic_Packet2, 4) != 0) {
 | 
			
		||||
        File Fhead(filename + ".dtsh");
 | 
			
		||||
        if (Fhead) {
 | 
			
		||||
          metaStorage = Fhead.metaStorage;
 | 
			
		||||
          metadata = metaStorage;
 | 
			
		||||
          sepHeader = true;
 | 
			
		||||
        } else {
 | 
			
		||||
          DEBUG_MSG(DLVL_ERROR, "%s is not a valid DTSC file", filename.c_str());
 | 
			
		||||
          fclose(F);
 | 
			
		||||
          F = 0;
 | 
			
		||||
          return;
 | 
			
		||||
        }
 | 
			
		||||
      if (memcmp(buffer, DTSC::Magic_Packet2, 4) != 0 && memcmp(buffer, DTSC::Magic_Packet, 4) != 0) {
 | 
			
		||||
        DEBUG_MSG(DLVL_ERROR, "%s is not a valid DTSC file", filename.c_str());
 | 
			
		||||
        fclose(F);
 | 
			
		||||
        F = 0;
 | 
			
		||||
        return;
 | 
			
		||||
      } else {
 | 
			
		||||
        metadata.moreheader = -1;
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue