- int * positions = malloc(num*sizeof(int));
- swf_GetUsedIDs(t, positions);
- int i;
- for(i=0;i<num;i++) {
- int id = GET16(&t->data[positions[i]]);
- PyObject*obj = tagmap_id2obj(tagmap, id);
- if(obj==NULL) {
- PyErr_SetString(PyExc_Exception, setError("TagID %d not defined", id));
- return NULL;
+ if(num) { // tag has dependencies
+ int * positions = malloc(num*sizeof(int));
+ swf_GetUsedIDs(t, positions);
+ int i;
+ for(i=0;i<num;i++) {
+ int id = GET16(&t->data[positions[i]]);
+ PyObject*obj = tagmap_id2obj(tagmap, id);
+ if(obj==NULL) {
+ PyErr_SetString(PyExc_Exception, setError("TagID %d not defined", id));
+ return NULL;
+ }
+ //mylog("+%08x(%d) tag_new2 handling id %d at %d/%d\n", (int)tag, tag->ob_refcnt, id, positions[i], t->len);
+ //mylog("+%08x(%d) tag_new2 add dependency %d to id %d, object %08x(%d)\n", (int)tag, tag->ob_refcnt, i, id, obj, obj->ob_refcnt);
+ tagmap_addMapping(tag->tagmap, id, obj);