Check and make sure we have a valid file before continuing
authorRobert Sesek <rsesek@bluestatic.org>
Tue, 26 Feb 2008 17:00:02 +0000 (12:00 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Tue, 26 Feb 2008 17:00:02 +0000 (12:00 -0500)
* Source/AppController.m:
([AppController uploadAndPrint:])

Source/AppController.m

index 2d5f4151fb48dd5020cd4f072829251d72685efb..f6b3fb8674ad722832cf7e90e408c31e11aa0348 100644 (file)
        struct hostent *host = gethostbyname("acs.bu.edu");
        memcpy(&sin.sin_addr, host->h_addr_list[0], host->h_length);
        
+       if (stat([[dragRegion filePath] UTF8String], &fileInfo))
+       {
+               return [self setStatus:@"Invalid file selected" isError:YES];
+       }
+       
        if (connect(sock, (struct sockaddr *)(&sin), sizeof(struct sockaddr_in)) != 0)
        {
                return [self setStatus:@"Could not connect to acs.bu.edu" isError:YES];
                goto shutdown;
        }
        
-       stat([[dragRegion filePath] UTF8String], &fileInfo);
-       
        LIBSSH2_CHANNEL *channel = libssh2_scp_send(ssh, "~/__bu_print_drop__.pdf", 0755, (unsigned long)fileInfo.st_size);
        if (!channel)
        {