Skip to content

Commit

Permalink
improve logging when something goes wrong (and one memory leak as bonus)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Oct 14, 2013
1 parent 69090ee commit 3e89600
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion wfm/src/Y2WFMComponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ bool Y2WFMComponent::createDefaultSCR ()
WFMSubAgent* scr = new WFMSubAgent ("scr", 0);

if (!scr->start ()) {
y2internal("Failed to start default SCR");
delete scr;
return false;
}

Expand Down Expand Up @@ -338,7 +340,10 @@ Y2WFMComponent::SCRGetName (const YCPInteger &h)

int handle = h->value ();
WFMSubAgents::iterator it = find_handle (handle);
return YCPString (it != scrs.end () ? (*it)->get_name () : "");
bool handle_found = it != scrs.end ();
if (!handle_found)
ycpinternal("SCRGetName for not existing handle %i", handle);
return YCPString ( handle_found ? (*it)->get_name () : "");
}


Expand Down

0 comments on commit 3e89600

Please sign in to comment.