Index: /trunk/ippScripts/scripts/videophot_process.pl
===================================================================
--- /trunk/ippScripts/scripts/videophot_process.pl	(revision 32778)
+++ /trunk/ippScripts/scripts/videophot_process.pl	(revision 32779)
@@ -32,4 +32,5 @@
 my $listvideocells = can_run('listvideocells.pl') or (warn "Can't find listvideocells.pl" and $missing_tools = 1);
 my $dsreg = can_run('dsreg') or (warn "Can't find dsreg" and $missing_tools = 1);
+my $nebrepair = can_run('neb-repair') or (warn "Can't find neb-repair" and $missing_tools = 1);
 if ($missing_tools) {
     warn("Can't find required tools.");
@@ -116,4 +117,5 @@
         run(command => $command, verbose => $verbose);
     unless ($success) {
+        check_input_file($uri, $vp_id, $class_id, 'nocell');
         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
         &my_die("Unable to perform $command: $error_code", $vp_id, $error_code);
@@ -135,4 +137,5 @@
                 run(command => $command, verbose => $verbose);
             unless ($success) {
+                check_input_file($uri, $vp_id, $class_id, $cell_id);
                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
                 &my_die("Unable to perform psvideophot: $error_code", $vp_id, $error_code);
@@ -244,4 +247,34 @@
 exit 0;
 
+sub check_input_file {
+    my $uri = shift;
+    my $vp_id = shift;
+    my $class_id = shift;
+    my $cell_id = shift;
+    my $resolved = $ipprc->file_resolve($uri);
+
+    my $tryrepair = 0;
+    if (!-e $resolved) {
+        printf STDERR "instance $resolved for $uri does not exist\n";
+        $tryrepair = 1;
+    } elsif (-s $resolved == 0) {
+        printf STDERR "instance $resolved for $uri is empty\n";
+        $tryrepair = 1;
+    }
+    if ($tryrepair) {
+        my $scheme = file_scheme($uri);
+        if ($scheme and ($scheme = 'neb')) {
+            my $command = "$nebrepair $uri";
+            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                run(command => $command, verbose => $verbose);
+            unless ($success) {
+                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                my $err_message = "Unable to perform nebrepair";
+                &my_die("$err_message: $error_code", $vp_id, $error_code);
+            }
+       }
+    }
+}
+
 sub my_die
 {
