char *xml_get_prop(xmlNode *node, char *nombre)
{
char *s;
- if (xmlGetProp(node, nombre) == NULL) {
+ s = xmlGetProp(node, nombre);
+ if (s == NULL) {
s = malloc(1);
s[0] = '\0';
return s;
}
- return xmlGetProp(node, nombre);
+ return s;
}
int eliminar_nodo_factura(t_LstFacturas *lst, t_Reg_Factura *nodo)
if (strcmp(node->name, "ITEMVENTA") == 0) {
count++;
tmp = realloc(tmp, sizeof(t_Item)*count);
- memset(&tmp[count-1], '*', sizeof(t_Item));
+ memset(&tmp[count-1], 0, sizeof(t_Item));
prop = xml_get_prop(node, "NroArtĂculo");
tmp[count-1].numero = atoi(prop);
xmlFree(prop);
PERR("Voy a cargar de un XML");
document = xmlReadFile(filename, "ISO-8859-1",0);
if (document == NULL) {
+ PERR("Error al leer documento!!");
free(tmp);
lst_facturas = NULL;
return NULL;
if (l == NULL) return 1;
emufs_destruir(l->fp);
+ emufs_destruir(l->fp_texto);
while (l->primero) {
del = l->primero;
l->primero = l->primero->sig;
mvwaddstr(win, 15, 2, "Numero");
mvwaddstr(win, 15, 11, "CV");
mvwaddstr(win, 15, 21, "PVU");
+ cant = 0;
do {
form_set_valor(form, "Nro de Articulo (* == fin)", "");
form_set_valor(form, "CV", "");
/* Agrego el Item */
cant++;
its = (t_Item *)realloc(its, cant*sizeof(t_Item));
- its[cant-1].numero = atoi(entrada);
- strcpy(its[cant-1].cv, form_obtener_valor_char(form, "CV"));
- strcpy(its[cant-1].pvu, form_obtener_valor_char(form, "PVU"));
+ if (its != NULL) {
+ its[cant-1].numero = atoi(entrada);
+ strcpy(its[cant-1].cv, form_obtener_valor_char(form, "CV"));
+ strcpy(its[cant-1].pvu, form_obtener_valor_char(form, "PVU"));
+ }
}
} while (entrada[0] != '*');