Index: trunk/ppSim/src/ppSimInsertSources.c
===================================================================
--- trunk/ppSim/src/ppSimInsertSources.c	(revision 14657)
+++ trunk/ppSim/src/ppSimInsertSources.c	(revision 14667)
@@ -5,7 +5,9 @@
     bool mdok;
 
+    assert (readout);
     assert (stars);
-    assert (readout);
-    
+
+    if (!stars->n) { return true; }
+
     // XXX is this needed?
     // pmFPAfile *simSources = psMetadataLookupPtr(NULL, config->files, "PPSIM.SOURCES"); // Output sources
@@ -88,4 +90,12 @@
 	pmSource *source = pmSourceFromModel (model, readout, radius, PM_SOURCE_TYPE_STAR);
 
+	// XXX set the mag & err values (should this be done in pmSourceFromModel?)
+	// XXX i should be applying the gain and the correct effective area
+	psEllipseAxes axes = pmPSF_ModelToAxes (model->params->data.F32, 20.0);
+	psF64 Area = 2.0 * M_PI * axes.major * axes.minor;
+
+	source->psfMag = -2.5*log10(star->flux);
+	source->errMag = sqrt(Area*PS_SQR(roughNoise) + star->flux) / star->flux;	
+	
 	// XXX add the sources to a source array
 
