Skip to content

Commit

Permalink
If anything is null it means the episode was not found
Browse files Browse the repository at this point in the history
  • Loading branch information
dbr committed May 15, 2009
1 parent 976c491 commit 3959fd9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tvdb_api_wrapper.m
Expand Up @@ -136,9 +136,28 @@ -(NSString*)getEpNameForSid:(NSNumber*)sid
withArgs:[NSArray arrayWithObject:sid]];

PyObject *season = PyObject_GetItem(show, PyInt_FromLong([seasno longValue]));
if(!season){
Py_Finalize();
NSLog(@"Panic, season is null");
return nil;
}

PyObject *episode = PyObject_GetItem(season, PyInt_FromLong([epno longValue]));
if(!episode){
Py_Finalize();
NSLog(@"Panic, episode is null");
return nil;
};

PyObject *attr = PyObject_GetItem(episode, PyString_FromString("episodename"));
if(!attr){
Py_Finalize();
NSLog(@"Panic, attr is null");
return nil;
}

NSString *epname = [NSString stringWithUTF8String:PyString_AsString(attr)];

Py_Finalize();
return epname;
}
Expand Down

0 comments on commit 3959fd9

Please sign in to comment.