Skip to content
Snippets Groups Projects
Commit 330bdef9 authored by Thibaut Hourlier's avatar Thibaut Hourlier
Browse files

Test if the object is defined before returning values

parent d5c25b3f
No related branches found
No related tags found
2 merge requests!1Fix precedence problem by replacing or with ||,!1Fix precedence problem by replacing or with ||
......@@ -3,6 +3,7 @@
use strict;
use warnings;
use Carp;
use IO::Handle;
use Getopt::Long;
use Tk;
......@@ -129,8 +130,10 @@ sub zconn {
($self->{zconn}) = @arg;
$self->try_send; # may have been postponed due to lack of zconn
}
return $self->{zconn} ||
die "Need zconn set now";
if (!$self->{zconn}) {
confess "Need zconn set now";
}
return $self->{zconn};
}
......@@ -261,8 +264,11 @@ sub new {
sub zconn {
my ($self, @arg) = @_;
($self->{zconn}) = @arg if @arg;
return $self->{zconn} ||
die "Need zconn set now";
if (!$self->{zconn}) {
confess "Need zconn set now";
}
return $self->{zconn};
}
sub on_timeout {
......
......@@ -19,6 +19,7 @@ sub main {
plan tests => 7;
my $handler = do_init();
# hold the ref to prevent garbage collection
print STDERR "AARRRGGG\n";
MainLoop();
return 0;
......@@ -31,9 +32,11 @@ sub do_init {
$M->clip_ids(@id);
$M->after(10000, sub { fail("whole-test timeout"); $M->destroy });
print STDERR "GGG\n";
my $handler = init_zircon_conn($M, @id);
$M->state_bump(new => @id);
print STDERR "RRRGGG\n";
return $handler;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment