Index: node_import/node_import.inc
===================================================================
--- node_import/node_import.inc	(Revision 202)
+++ node_import/node_import.inc	(Arbeitskopie)
@@ -862,7 +862,7 @@
     switch ($task['status']) {
       case NODE_IMPORT_STATUS_PENDING:
         if ($task['file_offset'] == 0 && $task['has_headers']) {
-          list($file_offset, $data) = node_import_read_from_file($task['file']->filepath, $file_offset, $task['file_options']);
+          list($file_offset, $data) = node_import_read_from_file($task['file']->filepath, $file_offset, $task['file_options'], $task['type']);
         }
         else {
           $file_offset = $task['file_offset'];
@@ -878,7 +878,7 @@
     module_invoke_all('node_import_task', $task, 'continue');
 
     while ($task['status'] != NODE_IMPORT_STATUS_DONE) {
-      list($new_offset, $data) = node_import_read_from_file($task['file']->filepath, $file_offset, $task['file_options']);
+      list($new_offset, $data, $skip) = node_import_read_from_file($task['file']->filepath, $file_offset, $task['file_options'], $task['type']);
 
       if (is_array($data)) {
         switch ($task['status']) {
@@ -895,7 +895,7 @@
         db_query("UPDATE {node_import_tasks} SET file_offset = %d, changed = %d WHERE taskid = %d", $new_offset, time(), $taskid);
         $task['file_offset'] = $new_offset;
 
-        $errors = node_import_create($task['type'], $data, $task['map'], $task['defaults'], $task['options'], FALSE);
+        $errors = $skip ? NULL : node_import_create($task['type'], $data, $task['map'], $task['defaults'], $task['options'], FALSE);
 
         if (is_array($errors)) {
           db_query("UPDATE {node_import_status} SET status = %d, errors = '%s' WHERE taskid = %d AND file_offset = %d", NODE_IMPORT_STATUS_ERROR, serialize($errors), $taskid, $file_offset);
@@ -1676,6 +1676,9 @@
  *   and 'escape character'. If not set, the options default to the
  *   CSV options ("\n", ',', '"', '"').
  *
+ * @param $type
+ *   String. The content type as returned as a key by hook_node_import_types().
+ *
  * @return
  *   Array ($file_offset, $record). The $file_offset is the start offset
  *   of the next record. The $record is an array of fields (strings).
@@ -1683,7 +1686,7 @@
  *   On error or when the end of the file has been reached we return
  *   FALSE.
  */
-function node_import_read_from_file($filepath, $file_offset, $file_options) {
+function node_import_read_from_file($filepath, $file_offset, $file_options, $type) {
   // Open file and set to file offset.
   if (($fp = fopen($filepath, 'r')) === FALSE) {
     return FALSE;
@@ -1808,13 +1811,16 @@
       break;
     }
   }
-  if ($empty_row && !feof($fp) && !empty($fields)) {
-    return node_import_read_from_file($filepath, $new_offset, $file_options);
-  }
 
+  // Skip empty rows
+  $skip   = $empty_row && !feof($fp) && !empty($fields);
+
+  // Unless we already skip check if we are forced to do so
+  $skip   = $skip || (is_array($fields) && in_array(TRUE, module_invoke_all('node_import_skip_record', $type, $fields)));
+
   // Cleanup and return.
-  $result = (!feof($fp) || !empty($fields)) ? array($new_offset, $fields) : FALSE;
-  unset($buffer);
+  $result = (!feof($fp) || !empty($fields)) ? array($new_offset, $fields, $skip) : FALSE;
+
   fclose($fp);
 
   return $result;
Index: node_import/node_import.api.php
===================================================================
--- node_import/node_import.api.php	(Revision 202)
+++ node_import/node_import.api.php	(Arbeitskopie)
@@ -609,3 +609,21 @@
 function hook_node_import_format_options_alter(&$formats, $op) {
 }
 
+/**
+ * Skip a an imported record
+ *
+ * @param $type
+ *    String. The content type as returned as a key by
+ *    hook_node_import_types().
+ *
+ * @param $values
+ *    Array. The raw record as an array.
+ *
+ * @return
+ *    Boolean. Return TRUE to imply you want to skip this record
+ *
+ * @ingroup node_import_hooks
+ */
+function hook_node_import_skip_record($type, $values) {
+}
+
Index: node_import/node_import.admin.inc
===================================================================
--- node_import/node_import.admin.inc	(Revision 202)
+++ node_import/node_import.admin.inc	(Arbeitskopie)
@@ -619,12 +619,16 @@
     $file_offset = 0;
     $data = array();
     while ($i > 0 && is_array($data)) {
-      $i--;
-      list($file_offset, $data) = node_import_read_from_file($file->filepath, $file_offset, $form_state['storage']['file_options']);
+      list($file_offset, $data, $skip) = node_import_read_from_file($file->filepath, $file_offset, $form_state['storage']['file_options'], $form_state['storage']['type']);
+
+      if ($skip) continue;
+
       if (is_array($data)) {
         $samples[] = $data;
         $num_cols = max($num_cols, count($data));
       }
+
+      $i--;
     }
 
     if (!$form_state['storage']['has_headers']) {
@@ -665,7 +669,7 @@
     $file_offset = 0;
     $data = array();
     if ($has_headers) {
-      list($file_offset, $data) = node_import_read_from_file($file->filepath, $file_offset, $form_state['storage']['file_options']);
+      list($file_offset, $data) = node_import_read_from_file($file->filepath, $file_offset, $form_state['storage']['file_options'], $form_state['storage']['type']);
     }
 
     global $node_import_can_continue;
@@ -675,11 +679,15 @@
     $form_state['storage']['options'] = isset($form_state['storage']['options']) ? $form_state['storage']['options'] : array();
 
     while ($preview_count > 0 && is_array($data) && $node_import_can_continue) {
-      $preview_count--;
-      list($file_offset, $data) = node_import_read_from_file($file->filepath, $file_offset, $form_state['storage']['file_options']);
+      list($file_offset, $data, $skip) = node_import_read_from_file($file->filepath, $file_offset, $form_state['storage']['file_options'], $form_state['storage']['type']);
+
+      if ($skip) continue;
+
       if (is_array($data)) {
         $previews[] = node_import_create($form_state['storage']['type'], $data, $form_state['storage']['map'], $form_state['storage']['defaults'], $form_state['storage']['options'], TRUE);
       }
+
+      $preview_count--;
     }
 
     if (!$node_import_can_continue) {
@@ -942,7 +950,10 @@
 
   $result = db_query($sql, $task['taskid']);
   while (($row = db_fetch_object($result))) {
-    list($file_offset, $data) = node_import_read_from_file($task['file']->filepath, $row->file_offset, $file_options);
+    list($file_offset, $data, $skip) = node_import_read_from_file($task['file']->filepath, $row->file_offset, $file_options, $task['type']);
+
+    if ($skip) continue;
+
     if ($objid) {
       array_unshift($data, $row->objid);
     }
@@ -1287,7 +1298,7 @@
     $row->errors = unserialize($row->errors);
     print '$row_status = '; var_dump($row);
 
-    list($file_offset, $data) = node_import_read_from_file($task['file']->filepath, $row->file_offset, $task['file_options']);
+    list($file_offset, $data) = node_import_read_from_file($task['file']->filepath, $row->file_offset, $task['file_options'], $task['type']);
     print '$data = '; var_dump($data);
   }
   print "\n";
