### Eclipse Workspace Patch 1.0
#P system
Index: src/lib/product/Daemon/Bugzilla.pm.in
===================================================================
RCS file: /projects/scmbug/cvsroot/system/src/lib/product/Daemon/Bugzilla.pm.in,v
retrieving revision 1.44
diff -u -r1.44 Bugzilla.pm.in
--- src/lib/product/Daemon/Bugzilla.pm.in	15 Oct 2007 20:55:20 -0000	1.44
+++ src/lib/product/Daemon/Bugzilla.pm.in	19 Oct 2007 17:18:21 -0000
@@ -762,6 +762,9 @@
 # $1 - Name of product on which a tag is added
 # $2 - Name of tag
 # $3 - Description of the tag
+# RETURNS:
+# - 0 on success
+# - 1,<a string describing the error> on failure
 sub integration_add_tag {
     my $self = shift;
     my ( $product_name, $tag_name, $description ) = ( @_ );
@@ -791,6 +794,9 @@
 	PopGlobalSQLState();
     } elsif ( $self->is_version_latest() ) {
 	my $product = new Bugzilla::Product( { name => $product_name } );
+	if(!defined $product) {
+        return 1, "Product does not exist.";
+    }
 	my $version = Bugzilla::Version::create( $tag_name, $product );
     }
 
@@ -807,12 +813,19 @@
 # PARAMETERS:
 # $1 - Name of product on which a tag is added
 # $2 - Name of tag
+# RETURNS:
+# - 0 does not exist
+# - 1 exists
+# - 2,<a string describing the error> on failure
 sub integration_tag_exists {
     my $self = shift;
     my ( $product_name, $tag_name ) = ( @_ );
 
     if ( $self->is_version_latest() ) {
 	my $product = new Bugzilla::Product( { name => $product_name } );
+	if(!defined $product) {
+        return 2, "Product does not exist.";
+    }
 	my $versions = $product->versions();
 	if ( $versions ) {
 	    foreach my $version ( @$versions ) {
@@ -864,14 +877,23 @@
 # PARAMETERS:
 # $1 - Name of product on which a tag is added
 # $2 - Name of tag
+# RETURNS:
+# - 0 on success
+# - 1,<a string describing the error> on failure
 sub integration_delete_tag {
     my $self = shift;
     my ( $product_name, $tag_name ) = ( @_ );
 
     if ( $self->is_version_latest() ) {
 	my $product = new Bugzilla::Product( { name => $product_name } );
+	if(!defined $product) {
+        return 1, "Product does not exist.";
+    }
 	my $version = new Bugzilla::Version( { product => $product,
 					       name => $tag_name } );
+    if(!defined $version) {
+        return 1, "Version does not exist.";
+    }
 	$version->remove_from_db;
     } else {
 	my $sql;
