Skip to content

Commit

Permalink
Merge branch 'develop' of repo.ch.internal:oss/spindle into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
cgueret committed Nov 28, 2016
2 parents fadcb8f + 181cdd3 commit d521b3b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions quilt/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct mediamatch_struct spindle_mediamatch[] = {
};

/* Const for audience defaults */
const char default_audience[][2] = {"all", NULL};
const char *default_audience[2] = {"all", NULL};

/* Peform a query using the SQL database back-end */
int
Expand Down Expand Up @@ -168,7 +168,7 @@ spindle_query_db(QUILTREQ *request, struct query_struct *query)
quilt_logf(LOG_DEBUG, QUILT_PLUGIN_NAME ": spindle_query_db: media='%s', type='%s'\n", query->media, query->type);
// audiences log
size_t i=0;
while (query->audience[i]) {
while(query->audience && query->audience[i]) {
quilt_logf(LOG_DEBUG, QUILT_PLUGIN_NAME ": spindle_query_db: audience='%s'\n", query->audience[i]);
i++;
}
Expand Down Expand Up @@ -323,7 +323,7 @@ spindle_query_db(QUILTREQ *request, struct query_struct *query)
int array_contains(char **array, const char *string)
{
size_t i=0;
while(array[i] != NULL) {
while(array && array[i] != NULL) {
if(!strcmp(array[i++], string))
{
quilt_logf(LOG_DEBUG, QUILT_PLUGIN_NAME ": array_contains %s TRUE\n", string);
Expand Down Expand Up @@ -356,7 +356,7 @@ spindle_query_db_media_(struct qbuf_struct *qbuf, struct query_struct *query)
*/
appendf(qbuf, " AND (\"m\".\"audience\" IS NULL");
size_t i=0;
while(query->audience[i]) {
while(query->audience && query->audience[i]) {
quilt_logf(LOG_DEBUG, QUILT_PLUGIN_NAME ": spindle_query_db_media_ adding audience %s'\n", query->audience[i]);
appendf(qbuf, " OR \"m\".\"audience\" = %%Q");
qbuf->args[qbuf->n] = query->audience[i];
Expand Down

0 comments on commit d521b3b

Please sign in to comment.